Skip to content

Commit

Permalink
ACPI fan: extract return values using PTR_ERR
Browse files Browse the repository at this point in the history
Need to extract errors using PTR_ERR macro and
process accordingly.  thermal_cooling_device_register
returning NULL means that CONFIG_THERMAL=n and in that
case no need to create symbolic links.

Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Thomas Sujith authored and Len Brown committed Feb 15, 2008
1 parent 3e6fda5 commit 19b3678
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions drivers/acpi/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,28 @@ static int acpi_fan_add(struct acpi_device *device)

cdev = thermal_cooling_device_register("Fan", device,
&fan_cooling_ops);
if (cdev)
if (IS_ERR(cdev)) {
result = PTR_ERR(cdev);
goto end;
}
if (cdev) {
printk(KERN_INFO PREFIX
"%s is registered as cooling_device%d\n",
device->dev.bus_id, cdev->id);
else
goto end;
acpi_driver_data(device) = cdev;
result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj,
"thermal_cooling");
if (result)
return result;

result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj,
"device");
if (result)
return result;
acpi_driver_data(device) = cdev;
result = sysfs_create_link(&device->dev.kobj,
&cdev->device.kobj,
"thermal_cooling");
if (result)
return result;

result = sysfs_create_link(&cdev->device.kobj,
&device->dev.kobj,
"device");
if (result)
return result;
}

result = acpi_fan_add_fs(device);
if (result)
Expand Down

0 comments on commit 19b3678

Please sign in to comment.