summaryrefslogtreecommitdiffstats
path: root/drivers/misc/intel_menlow.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/intel_menlow.c')
-rw-r--r--drivers/misc/intel_menlow.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c
index 5bb8816c912..80a13635240 100644
--- a/drivers/misc/intel_menlow.c
+++ b/drivers/misc/intel_menlow.c
@@ -179,14 +179,22 @@ static int intel_menlow_memory_add(struct acpi_device *device)
result = sysfs_create_link(&device->dev.kobj,
&cdev->device.kobj, "thermal_cooling");
if (result)
- printk(KERN_ERR PREFIX "Create sysfs link\n");
+ goto unregister;
+
result = sysfs_create_link(&cdev->device.kobj,
&device->dev.kobj, "device");
- if (result)
- printk(KERN_ERR PREFIX "Create sysfs link\n");
+ if (result) {
+ sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+ goto unregister;
+ }
end:
return result;
+
+ unregister:
+ thermal_cooling_device_unregister(cdev);
+ return result;
+
}
static int intel_menlow_memory_remove(struct acpi_device *device, int type)