[PATCH] Fix manual binding infinite loop
authorGreg KH <gregkh@suse.de>
Thu, 18 Aug 2005 00:33:11 +0000 (17:33 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 18 Aug 2005 05:02:25 +0000 (22:02 -0700)
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 <mostrows@watson.ibm.com> for pointing the
problem out.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/base/bus.c

index 96fe2f9..ab53832 100644 (file)
@@ -180,7 +180,9 @@ static ssize_t driver_bind(struct device_driver *drv,
                up(&dev->sem);
                put_device(dev);
        }
-       return err;
+       if (err)
+               return err;
+       return count;
 }
 static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);