lkml.org 
[lkml]   [2009]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 3/6] ACPI: dock: clean up one more error path in dock_add()
From
Date
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;


\
 
 \ /
  Last update: 2009-10-08 00:15    [W:2.131 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site