]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/intel_menlow.c
ACPI: catch calls of acpi_driver_data on pointer of wrong type
[linux-2.6-omap-h63xx.git] / drivers / misc / intel_menlow.c
index 5bb8816c912688a0ffe85d3aa86b6aca80f4120c..cd3ea7faa5b6bd4cf55d3bd2ec2c2c0436f0ae41 100644 (file)
@@ -175,18 +175,26 @@ static int intel_menlow_memory_add(struct acpi_device *device)
                goto end;
        }
 
-       acpi_driver_data(device) = cdev;
+       device->driver_data = cdev;
        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)