[PATCH 3/6] ACPI: dock: clean up one more error path in dock_add()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove one final redundant error handling path and reduce repetitiveness.

Signed-off-by: Alex Chiang <achiang@xxxxxx>
---

 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-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux