[dpdk-dev] pci: do not mark device as taken when probe fails

Message ID 1478509409-25508-1-git-send-email-david.marchand@6wind.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
tmonjalo/checkpatch success coding style OK

Commit Message

David Marchand Nov. 7, 2016, 9:03 a.m. UTC
  dev->driver should be set only if a driver did take the device.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/common/eal_common_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon Nov. 7, 2016, 1:42 p.m. UTC | #1
2016-11-07 10:03, David Marchand:
> dev->driver should be set only if a driver did take the device.
> 
> Signed-off-by: David Marchand <david.marchand@6wind.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 971ad20..6163b09 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -214,7 +214,11 @@  rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 		dev->driver = dr;
 
 		/* call the driver probe() function */
-		return dr->probe(dr, dev);
+		ret = dr->probe(dr, dev);
+		if (ret)
+			dev->driver = NULL;
+
+		return ret;
 	}
 	/* return positive value if driver doesn't support this device */
 	return 1;