[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091007220742.15597.91712.stgit@bob.kio>
Date: Wed, 07 Oct 2009 16:07:42 -0600
From: Alex Chiang <achiang@...com>
To: lenb@...nel.org
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 3/6] ACPI: dock: clean up one more error path in dock_add()
Remove one final redundant error handling path and reduce repetitiveness.
Signed-off-by: Alex Chiang <achiang@...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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists