]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
hwmon: (abituguru3) Convert to use devm_ functions
authorGuenter Roeck <linux@roeck-us.net>
Sat, 2 Jun 2012 16:57:57 +0000 (09:57 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 18 Aug 2012 23:34:58 +0000 (16:34 -0700)
Convert to use devm_ functions to reduce code size and simplify the code.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Alistair John Strachan <alistair@devzero.co.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/abituguru3.c

index 5d582aebff8747343938ec3e5d89c6cb58f9a775..b174b8b2b4dfedcc8bc8879f6f44b6825e6d8747 100644 (file)
@@ -976,7 +976,8 @@ static int __devinit abituguru3_probe(struct platform_device *pdev)
        u8 buf[2];
        u16 id;
 
-       data = kzalloc(sizeof(struct abituguru3_data), GFP_KERNEL);
+       data = devm_kzalloc(&pdev->dev, sizeof(struct abituguru3_data),
+                           GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
@@ -1068,7 +1069,6 @@ abituguru3_probe_error:
        for (i = 0; i < ARRAY_SIZE(abituguru3_sysfs_attr); i++)
                device_remove_file(&pdev->dev,
                        &abituguru3_sysfs_attr[i].dev_attr);
-       kfree(data);
        return res;
 }
 
@@ -1084,8 +1084,6 @@ static int __devexit abituguru3_remove(struct platform_device *pdev)
        for (i = 0; i < ARRAY_SIZE(abituguru3_sysfs_attr); i++)
                device_remove_file(&pdev->dev,
                        &abituguru3_sysfs_attr[i].dev_attr);
-       kfree(data);
-
        return 0;
 }