lkml.org 
[lkml]   [2008]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[patch 3/6] ACPI fan: extract return values using PTR_ERR
Date
From
From: Thomas Sujith <sujith.thomas@intel.com>

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>
---

drivers/acpi/fan.c | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)

Index: linux-2.6.24/drivers/acpi/fan.c
===================================================================
--- linux-2.6.24.orig/drivers/acpi/fan.c
+++ linux-2.6.24/drivers/acpi/fan.c
@@ -256,22 +256,28 @@ static int acpi_fan_add(struct acpi_devi

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)[unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2008-02-15 06:27    [W:0.062 / U:0.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site