Skip to contentSkip to conversation

driver core: Change function call order in device_bind_driver().

PATCH New Cornelia Huck 1 participant 1 message Oct 27, 2006 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 5/7 driver core: Change function call order in device_bind_driver().

From: Cornelia Huck <[email protected]>

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).

---
 drivers/base/dd.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/base/dd.c +6 -2
@@ -85,8 +85,12 @@ static void driver_sysfs_remove(struct d
  */
 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 {