Skip to content

Commit

Permalink
intel_menlo: 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 43ff39f commit 69f6b8d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/misc/intel_menlow.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ static int intel_menlow_memory_add(struct acpi_device *device)

cdev = thermal_cooling_device_register("Memory controller", device,
&memory_cooling_ops);
acpi_driver_data(device) = cdev;
if (!cdev)
result = -ENODEV;
else {
if (IS_ERR(cdev)) {
result = PTR_ERR(cdev);
goto end;
}

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

0 comments on commit 69f6b8d

Please sign in to comment.