summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/mc13783-adc.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 09:49:11 -0700
committerGuenter Roeck <linux@roeck-us.net>2012-07-21 21:48:38 -0700
commited2e073b13c72de422afa75f7c9f4869ec3018cd (patch)
treed59325e0bc07532c4d57e17c5c80e852867209ba /drivers/hwmon/mc13783-adc.c
parentb07405fbc38f2e7f2eef2f38fa724a7510ae14aa (diff)
downloadlinux-ed2e073b13c72de422afa75f7c9f4869ec3018cd.tar.gz
linux-ed2e073b13c72de422afa75f7c9f4869ec3018cd.tar.bz2
linux-ed2e073b13c72de422afa75f7c9f4869ec3018cd.zip
hwmon: (mc13783-adc.c) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/hwmon/mc13783-adc.c')
-rw-r--r--drivers/hwmon/mc13783-adc.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/hwmon/mc13783-adc.c b/drivers/hwmon/mc13783-adc.c
index ce86c5e3c2c2..cf47a59657a9 100644
--- a/drivers/hwmon/mc13783-adc.c
+++ b/drivers/hwmon/mc13783-adc.c
@@ -179,7 +179,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)
const struct platform_device_id *id = platform_get_device_id(pdev);
char *dash;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -194,7 +194,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)
/* Register sysfs hooks */
ret = sysfs_create_group(&pdev->dev.kobj, &mc13783_group_base);
if (ret)
- goto out_err_create_base;
+ return ret;
if (id->driver_data & MC13783_ADC_16CHANS) {
ret = sysfs_create_group(&pdev->dev.kobj,
@@ -230,11 +230,6 @@ out_err_create_ts:
out_err_create_16chans:
sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_base);
-out_err_create_base:
-
- platform_set_drvdata(pdev, NULL);
- kfree(priv);
-
return ret;
}
@@ -253,9 +248,6 @@ static int __devexit mc13783_adc_remove(struct platform_device *pdev)
sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_base);
- platform_set_drvdata(pdev, NULL);
- kfree(priv);
-
return 0;
}