Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bc8f0a26855d8fac68040d462ec3cc13884e98e5
Commit:     bc8f0a26855d8fac68040d462ec3cc13884e98e5
Parent:     cae2caae78258d623c7b687029a19fa6b33c76f4
Author:     Hans de Goede <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 14 21:15:05 2007 +0100
Committer:  Jean Delvare <[EMAIL PROTECTED]>
CommitDate: Wed Feb 14 21:15:05 2007 +0100

    hwmon/abituguru: Fix unchecked return status
    
    Fix an unused return value warning for the abituguru driver.
    Also make sure the sysfs files are created before we register with
    the hwmon class, and delete the sysfs files on driver removal.
    
    Signed-off-by: Hans de Goede <[EMAIL PROTECTED]>
    Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
---
 drivers/hwmon/abituguru.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index b1dc63e..bede4d9 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -1267,30 +1267,42 @@ static int __devinit abituguru_probe(struct 
platform_device *pdev)
        printk(KERN_INFO ABIT_UGURU_NAME ": found Abit uGuru\n");
 
        /* Register sysfs hooks */
-       data->class_dev = hwmon_device_register(&pdev->dev);
-       if (IS_ERR(data->class_dev)) {
-               res = PTR_ERR(data->class_dev);
-               goto abituguru_probe_error;
-       }
        for (i = 0; i < sysfs_attr_i; i++)
-               device_create_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
+               if (device_create_file(&pdev->dev,
+                               &data->sysfs_attr[i].dev_attr))
+                       goto abituguru_probe_error;
        for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
-               device_create_file(&pdev->dev,
-                       &abituguru_sysfs_attr[i].dev_attr);
+               if (device_create_file(&pdev->dev,
+                               &abituguru_sysfs_attr[i].dev_attr))
+                       goto abituguru_probe_error;
 
-       return 0;
+       data->class_dev = hwmon_device_register(&pdev->dev);
+       if (!IS_ERR(data->class_dev))
+               return 0; /* success */
 
+       res = PTR_ERR(data->class_dev);
 abituguru_probe_error:
+       for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
+               device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
+       for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
+               device_remove_file(&pdev->dev,
+                       &abituguru_sysfs_attr[i].dev_attr);
        kfree(data);
        return res;
 }
 
 static int __devexit abituguru_remove(struct platform_device *pdev)
 {
+       int i;
        struct abituguru_data *data = platform_get_drvdata(pdev);
 
        platform_set_drvdata(pdev, NULL);
        hwmon_device_unregister(data->class_dev);
+       for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
+               device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
+       for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
+               device_remove_file(&pdev->dev,
+                       &abituguru_sysfs_attr[i].dev_attr);
        kfree(data);
 
        return 0;
-
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