Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19b36780ee7ddeb5080e3f1f858a83c4824f1fdc
Commit:     19b36780ee7ddeb5080e3f1f858a83c4824f1fdc
Parent:     3e6fda5c1159823fc02463eceb564c8bfc0e7a0e
Author:     Thomas Sujith <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 15 01:01:52 2008 -0500
Committer:  Len Brown <[EMAIL PROTECTED]>
CommitDate: Fri Feb 15 18:21:30 2008 -0500

    ACPI fan: extract return values using PTR_ERR
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Len Brown <[EMAIL PROTECTED]>
---
 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 48cb705..c8e3cba 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -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)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to