lkml.org 
[lkml]   [2008]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] provide error handling for unclean objects
Date
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@redhat.com>
---
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


\
 
 \ /
  Last update: 2008-02-18 22:09    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site