[PATCH 3/4] provide error handling for unclean objects

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

 



Previously, if acpi_processor_start() failed to
create sysfs nodes, it would leave stuff to be cleaned,
that won't perish in acpi_processor_remove(),
since we'll have pr->cdev == NULL.

This patch cleans those objects.

Signed-off-by: Glauber Costa <gcosta@xxxxxxxxxx>
---
 drivers/acpi/processor_core.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 5023410..06a230a 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -680,11 +680,12 @@ #endif
 	result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj,
 					"thermal_cooling");
 	if (result)
-		return result;
+		goto err_thermal;
+
 	result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj,
 					"device");
 	if (result)
-		return result;
+		goto err_sysfs;
 
 	pr->cdev = cdev;
 
@@ -694,9 +695,13 @@ #endif
 		printk(" %d throttling states", pr->throttling.state_count);
 		printk(")\n");
 	}
+	return result;
 
-      end:
-
+err_sysfs:
+	sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+err_thermal:
+	thermal_cooling_device_unregister(pr->cdev);
+end:
 	return result;
 }
 
-- 
1.4.2

-
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