pci: unset driver if probe fails
authorDavid Marchand <david.marchand@6wind.com>
Mon, 7 Nov 2016 09:03:29 +0000 (10:03 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 7 Nov 2016 13:50:47 +0000 (14:50 +0100)
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

index 971ad20..6163b09 100644 (file)
@@ -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;