[dpdk-dev] dev: fix dev_attach proceeding with vdev on success

Message ID 3505500ec4b4a452528da1eb2076e11bdc22068c.1501069907.git.gaetan.rivet@6wind.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Gaëtan Rivet July 26, 2017, 11:52 a.m. UTC
  When rte_eal_hotplug_add() successfully probe a device, the return value
is zero. The check afterward only returns on error different from
-EINVAL. It should return also on success, as there is no need to
attempt probing the device with vdev.

Fixes: 0bba9e605048 ("eal: use new hotplug API in attach")
Cc: stable@dpdk.org
Cc: Jan Blunck <jblunck@infradead.org>

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/common/eal_common_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon July 31, 2017, 7:46 a.m. UTC | #1
26/07/2017 13:52, Gaetan Rivet:
> When rte_eal_hotplug_add() successfully probe a device, the return value
> is zero. The check afterward only returns on error different from
> -EINVAL. It should return also on success, as there is no need to
> attempt probing the device with vdev.
> 
> Fixes: 0bba9e605048 ("eal: use new hotplug API in attach")
> Cc: stable@dpdk.org
> Cc: Jan Blunck <jblunck@infradead.org>
> 
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index e10b9fd..d74f978 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -74,7 +74,7 @@  int rte_eal_dev_attach(const char *name, const char *devargs)
 	}
 
 	ret = rte_eal_hotplug_add("pci", name, devargs);
-	if (ret && ret != -EINVAL)
+	if (ret != -EINVAL)
 		return ret;
 
 	/*