From: Greg KH Date: Thu, 18 Aug 2005 00:33:11 +0000 (-0700) Subject: [PATCH] Fix manual binding infinite loop X-Git-Tag: v2.6.13-rc7~60^2~1 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=518e6540831c69422faecceee8f964bd439ac9d0;p=~shefty%2Frdma-dev.git [PATCH] 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 for pointing the problem out. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 96fe2f95675..ab53832d57e 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -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);