]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
hwmon: (sch5627) Convert to use devm_ functions
authorGuenter Roeck <linux@roeck-us.net>
Sat, 2 Jun 2012 18:20:21 +0000 (11:20 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 15 Sep 2012 14:57:26 +0000 (07:57 -0700)
Convert to use devm_ functions to reduce code size and simplify the code.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/sch5627.c

index 8342275378b85759f57b9af583f34d281e58cd25..49f6230bdcf133b473d27a92b223d9dc1c50aada 100644 (file)
@@ -461,8 +461,6 @@ static int sch5627_remove(struct platform_device *pdev)
                hwmon_device_unregister(data->hwmon_dev);
 
        sysfs_remove_group(&pdev->dev.kobj, &sch5627_group);
-       platform_set_drvdata(pdev, NULL);
-       kfree(data);
 
        return 0;
 }
@@ -472,7 +470,8 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
        struct sch5627_data *data;
        int err, build_code, build_id, hwmon_rev, val;
 
-       data = kzalloc(sizeof(struct sch5627_data), GFP_KERNEL);
+       data = devm_kzalloc(&pdev->dev, sizeof(struct sch5627_data),
+                           GFP_KERNEL);
        if (!data)
                return -ENOMEM;