Skip to contentSkip to conversation

Fix manual binding infinite loop

PATCH New Greg KH 1 participant 1 message Aug 18, 2005 Driver core

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 Fix manual binding infinite loop

Fix for manual binding of drivers to devices. Problem is if you pass in a valid device id, but the driver refuses to bind. Infinite loop as write() tries to resubmit the data it just sent.

Thanks to Michal Ostrowski <[email protected]> for pointing the problem out.

---
 drivers/base/bus.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)
drivers/base/bus.c +3 -1
@@ -180,7 +180,9 @@ static ssize_t driver_bind(struct device
 		up(&dev->sem);
 		put_device(dev);
 	}
-	return err;
+	if (err)
+		return err;
+	return count;
 }
 static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);