Messages in this thread Patch in this message | | | Subject | [PATCH 3/6] ACPI: dock: clean up one more error path in dock_add() | From | Alex Chiang <> | Date | Wed, 07 Oct 2009 16:07:42 -0600 |
| |
Remove one final redundant error handling path and reduce repetitiveness.
Signed-off-by: Alex Chiang <achiang@hp.com> ---
drivers/acpi/dock.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 390adee..1d693a1 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -968,11 +968,10 @@ static int dock_add(acpi_handle handle) platform_device_register_simple(dock_device_name, dock_station_count, NULL, 0); dock_device = ds->dock_device; - if (IS_ERR(dock_device)) { - kfree(ds); - ds = NULL; - return PTR_ERR(dock_device); - } + ret = IS_ERR(dock_device) ? PTR_ERR(dock_device) : 0; + if (ret) + goto err_free; + platform_device_add_data(dock_device, &ds, sizeof(struct dock_station *)); @@ -1036,6 +1035,7 @@ err_unregister1: err_unregister: printk(KERN_ERR "%s encountered error %d\n", __func__, ret); platform_device_unregister(dock_device); +err_free: kfree(ds); ds = NULL; return ret;
| |