[PATCH] Fix manual binding infinite loop
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 18 Aug 2005 00:33:11 +0000 (17:33 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Sep 2005 23:03:09 +0000 (16:03 -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>
drivers/base/bus.c

index ab53832d57e5eff507b8e4552983446641f02d51..6966aff74efe5a07c76478affebdcafbc021f5df 100644 (file)
@@ -156,7 +156,9 @@ static ssize_t driver_unbind(struct device_driver *drv,
                device_release_driver(dev);
                err = count;
        }
-       return err;
+       if (err)
+               return err;
+       return count;
 }
 static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);