Skip to contentSkip to conversation

Driver core: coding style cleanup

PATCH New Cornelia Huck 1 participant 1 message May 16, 2007 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Driver core: coding style cleanup

[This goes on top of driver-core-check-return-code-of-sysfs_create_link.patch]

From: Cornelia Huck <[email protected]>

This converts code of the form

	if ((error = some_func()))
		goto fixup;
to
	error = some_func();
	if (error)
		goto fixup;
---
 drivers/base/bus.c  |    6 ++++--
 drivers/base/core.c |   12 ++++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)
drivers/base/core.c +8 -4
@@ -764,13 +764,17 @@ int device_add(struct device *dev)
 		if (error)
 			goto ueventattrError;
 	}
-	if ((error = device_add_class_symlinks(dev)))
+	error = device_add_class_symlinks(dev);
+	if (error)
 		goto SymlinkError;
-	if ((error = device_add_attrs(dev)))
+	error = device_add_attrs(dev);
+	if (error)
 		goto AttrsError;
-	if ((error = device_pm_add(dev)))
+	error = device_pm_add(dev);
+	if (error)
 		goto PMError;
-	if ((error = bus_add_device(dev)))
+	error = bus_add_device(dev);
+	if (error)
 		goto BusError;
 	kobject_uevent(&dev->kobj, KOBJ_ADD);
 	bus_attach_device(dev);
drivers/base/bus.c +4 -2
@@ -608,7 +608,8 @@ int bus_add_driver(struct device_driver 
 	if (error)
 		goto out_put_bus;
 	drv->kobj.kset = &bus->drivers;
-	if ((error = kobject_register(&drv->kobj)))
+	error = kobject_register(&drv->kobj);
+	if (error)
 		goto out_put_bus;
 
 	if (drv->bus->drivers_autoprobe) {
@@ -757,7 +758,8 @@ static int bus_add_attrs(struct bus_type
 
 	if (bus->bus_attrs) {
 		for (i = 0; attr_name(bus->bus_attrs[i]); i++) {
-			if ((error = bus_create_file(bus,&bus->bus_attrs[i])))
+			error = bus_create_file(bus,&bus->bus_attrs[i]);
+			if (error)
 				goto Err;
 		}
 	}