diff options
-rw-r--r-- | drivers/acpi/fan.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 48cb705b274a..c8e3cba423ef 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -256,22 +256,28 @@ static int acpi_fan_add(struct acpi_device *device) | |||
256 | 256 | ||
257 | cdev = thermal_cooling_device_register("Fan", device, | 257 | cdev = thermal_cooling_device_register("Fan", device, |
258 | &fan_cooling_ops); | 258 | &fan_cooling_ops); |
259 | if (cdev) | 259 | if (IS_ERR(cdev)) { |
260 | result = PTR_ERR(cdev); | ||
261 | goto end; | ||
262 | } | ||
263 | if (cdev) { | ||
260 | printk(KERN_INFO PREFIX | 264 | printk(KERN_INFO PREFIX |
261 | "%s is registered as cooling_device%d\n", | 265 | "%s is registered as cooling_device%d\n", |
262 | device->dev.bus_id, cdev->id); | 266 | device->dev.bus_id, cdev->id); |
263 | else | ||
264 | goto end; | ||
265 | acpi_driver_data(device) = cdev; | ||
266 | result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj, | ||
267 | "thermal_cooling"); | ||
268 | if (result) | ||
269 | return result; | ||
270 | 267 | ||
271 | result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj, | 268 | acpi_driver_data(device) = cdev; |
272 | "device"); | 269 | result = sysfs_create_link(&device->dev.kobj, |
273 | if (result) | 270 | &cdev->device.kobj, |
274 | return result; | 271 | "thermal_cooling"); |
272 | if (result) | ||
273 | return result; | ||
274 | |||
275 | result = sysfs_create_link(&cdev->device.kobj, | ||
276 | &device->dev.kobj, | ||
277 | "device"); | ||
278 | if (result) | ||
279 | return result; | ||
280 | } | ||
275 | 281 | ||
276 | result = acpi_fan_add_fs(device); | 282 | result = acpi_fan_add_fs(device); |
277 | if (result) | 283 | if (result) |