From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 662E51B0FC for ; Wed, 21 Nov 2018 19:39:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2018 10:39:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,262,1539673200"; d="scan'208";a="110457410" Received: from violet.igk.intel.com ([10.102.54.137]) by orsmga002.jf.intel.com with ESMTP; 21 Nov 2018 10:39:22 -0800 From: Darek Stojaczyk To: dev@dpdk.org Cc: Darek Stojaczyk , gaetan.rivet@6wind.com Date: Wed, 21 Nov 2018 19:37:50 +0100 Message-Id: <20181121183750.33796-1-dariusz.stojaczyk@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] dev: don't remove devargs that are still referenced X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2018 18:39:25 -0000 Even if a device failed to plug, it's still a device object that references the devargs. Those devargs will be freed automatically together with the device, but can't be freed any earlier. Fixes: 7e8b26650146 ("eal: fix hotplug add / remove") Cc: gaetan.rivet@6wind.com Signed-off-by: Darek Stojaczyk --- lib/librte_eal/common/eal_common_dev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 1fdc9ab17..b6fc5e437 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -169,11 +169,10 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev) ret = dev->bus->plug(dev); if (ret) { - if (rte_dev_is_probed(dev)) /* if already succeeded earlier */ - return ret; /* no rollback */ - RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", - dev->name); - goto err_devarg; + if (!rte_dev_is_probed(dev)) /* if hasn't succeeded earlier */ + RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", + dev->name); + return ret; } *new_dev = dev; -- 2.17.1