driver core: Change function call order in device_bind_driver().
authorCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 27 Nov 2006 09:35:12 +0000 (10:35 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Feb 2007 18:37:13 +0000 (10:37 -0800)
Change function call order in device_bind_driver().

If we create symlinks (which might fail) before adding the device to the list
we don't have to clean up afterwards (which we didn't).

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/dd.c

index f7051374894774b2b1c81974ee8bb59ea4d7e685..b5bf243d9cd6a26afc47eabb2990cf2d4cf13884 100644 (file)
@@ -86,8 +86,12 @@ static void driver_sysfs_remove(struct device *dev)
  */
 int device_bind_driver(struct device *dev)
 {
-       driver_bound(dev);
-       return driver_sysfs_add(dev);
+       int ret;
+
+       ret = driver_sysfs_add(dev);
+       if (!ret)
+               driver_bound(dev);
+       return ret;
 }
 
 struct stupid_thread_structure {