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; Signed-off-by: Cornelia Huck <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- drivers/base/bus.c | 6 ++++-- drivers/base/core.c | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 7ff5aaf..f299e0d 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -622,7 +622,8 @@ int bus_add_driver(struct device_driver *drv) 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) { @@ -772,7 +773,8 @@ static int bus_add_attrs(struct bus_type * bus) 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; } } diff --git a/drivers/base/core.c b/drivers/base/core.c index dd40d78..cff4fbf 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -733,11 +733,14 @@ int device_add(struct device *dev) } } - 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); -- 1.5.2.2 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 19/61] idr: fix obscure bug in allocation path
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 19/61] idr: fix obscure bug in allocation path
- References:
- [GIT PATCH] sysfs and driver core patches for 2.6.22
- From: Greg KH <[email protected]>
- [PATCH 01/61] Rules on how to use sysfs in userspace programs
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 02/61] debugfs: add rename for debugfs files
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 03/61] DMI-based module autoloading
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 04/61] Driver core: add missing kset uevent
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 05/61] sysdev: use mutex instead of semaphore
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 06/61] Power Management: use mutexes instead of semaphores
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 07/61] PM: Remove pm_parent from struct dev_pm_info
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 08/61] PM: Remove saved_state from struct dev_pm_info
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 09/61] PM: Simplify suspend_device
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 10/61] Driver core: include linux/mutex.h from attribute_container.c
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 11/61] driver core: properly get driver in device_release_driver
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 12/61] driver core: fix kernel doc of device_release_driver
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 13/61] Driver core: fix devres_release_all() return value
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 14/61] PM: Remove prev_state from struct dev_pm_info
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 15/61] PM: Remove power_state.event checks from suspend core code
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 16/61] PM: Do not check parent state in suspend and resume core code
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 17/61] PM: do not use saved_state from struct dev_pm_info on ARM
- From: Greg Kroah-Hartman <[email protected]>
- [GIT PATCH] sysfs and driver core patches for 2.6.22
- Prev by Date: [PATCH 17/61] PM: do not use saved_state from struct dev_pm_info on ARM
- Next by Date: [PATCH 19/61] idr: fix obscure bug in allocation path
- Previous by thread: [PATCH 17/61] PM: do not use saved_state from struct dev_pm_info on ARM
- Next by thread: [PATCH 19/61] idr: fix obscure bug in allocation path
- Index(es):