diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 14:48:02 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:37 -0400 |
commit | e7d5bf7ed59ce26d3e6fc12ada497f42efd393ef (patch) | |
tree | 5c599feb93b604ac48ddd019ace1483a8b0acd4d /drivers/hwmon/wm831x-hwmon.c | |
parent | e41f6432d1ca757d8e4a2dccfd772e421d640e98 (diff) |
hwmon: (wm831x-hwmon) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/hwmon/wm831x-hwmon.c')
-rw-r--r-- | drivers/hwmon/wm831x-hwmon.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hwmon/wm831x-hwmon.c b/drivers/hwmon/wm831x-hwmon.c index 07cb25ae69be..d0db1f2738fb 100644 --- a/drivers/hwmon/wm831x-hwmon.c +++ b/drivers/hwmon/wm831x-hwmon.c | |||
@@ -163,7 +163,8 @@ static int __devinit wm831x_hwmon_probe(struct platform_device *pdev) | |||
163 | struct wm831x_hwmon *hwmon; | 163 | struct wm831x_hwmon *hwmon; |
164 | int ret; | 164 | int ret; |
165 | 165 | ||
166 | hwmon = kzalloc(sizeof(struct wm831x_hwmon), GFP_KERNEL); | 166 | hwmon = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_hwmon), |
167 | GFP_KERNEL); | ||
167 | if (!hwmon) | 168 | if (!hwmon) |
168 | return -ENOMEM; | 169 | return -ENOMEM; |
169 | 170 | ||
@@ -171,7 +172,7 @@ static int __devinit wm831x_hwmon_probe(struct platform_device *pdev) | |||
171 | 172 | ||
172 | ret = sysfs_create_group(&pdev->dev.kobj, &wm831x_attr_group); | 173 | ret = sysfs_create_group(&pdev->dev.kobj, &wm831x_attr_group); |
173 | if (ret) | 174 | if (ret) |
174 | goto err; | 175 | return ret; |
175 | 176 | ||
176 | hwmon->classdev = hwmon_device_register(&pdev->dev); | 177 | hwmon->classdev = hwmon_device_register(&pdev->dev); |
177 | if (IS_ERR(hwmon->classdev)) { | 178 | if (IS_ERR(hwmon->classdev)) { |
@@ -185,8 +186,6 @@ static int __devinit wm831x_hwmon_probe(struct platform_device *pdev) | |||
185 | 186 | ||
186 | err_sysfs: | 187 | err_sysfs: |
187 | sysfs_remove_group(&pdev->dev.kobj, &wm831x_attr_group); | 188 | sysfs_remove_group(&pdev->dev.kobj, &wm831x_attr_group); |
188 | err: | ||
189 | kfree(hwmon); | ||
190 | return ret; | 189 | return ret; |
191 | } | 190 | } |
192 | 191 | ||
@@ -196,8 +195,6 @@ static int __devexit wm831x_hwmon_remove(struct platform_device *pdev) | |||
196 | 195 | ||
197 | hwmon_device_unregister(hwmon->classdev); | 196 | hwmon_device_unregister(hwmon->classdev); |
198 | sysfs_remove_group(&pdev->dev.kobj, &wm831x_attr_group); | 197 | sysfs_remove_group(&pdev->dev.kobj, &wm831x_attr_group); |
199 | platform_set_drvdata(pdev, NULL); | ||
200 | kfree(hwmon); | ||
201 | 198 | ||
202 | return 0; | 199 | return 0; |
203 | } | 200 | } |