Skip to contentSkip to conversation

driver core: Don't stop probing on ->probe errors.

PATCH New Cornelia Huck 1 participant 1 message Oct 27, 2006 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 4/7 driver core: Don't stop probing on ->probe errors.

From: Cornelia Huck <[email protected]>

Don't stop on the first ->probe error that is not -ENODEV/-ENXIO.

There might be a driver registered returning an unresonable return code, and this stops probing completely even though it may make sense to try the next possible driver. At worst, we may end up with an unbound device.

---
 drivers/base/dd.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/base/dd.c +6 -7
@@ -133,18 +133,17 @@ probe_failed:
 	driver_sysfs_remove(dev);
 	dev->driver = NULL;
 
-	if (ret == -ENODEV || ret == -ENXIO) {
-		/* Driver matched, but didn't support device
-		 * or device not found.
-		 * Not an error; keep going.
-		 */
-		ret = 0;
-	} else {
+	if (ret != -ENODEV && ret != -ENXIO) {
 		/* driver matched but the probe failed */
 		printk(KERN_WARNING
 		       "%s: probe of %s failed with error %d\n",
 		       drv->name, dev->bus_id, ret);
 	}
+	/*
+	 * Ignore errors returned by ->probe so that the next driver can try
+	 * its luck.
+	 */
+	ret = 0;
 done:
 	kfree(data);
 	atomic_dec(&probe_count);