diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-07-13 05:06:28 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:45 -0400 |
commit | 41bf870e6db130c6e467c70b6da96398066b8be7 (patch) | |
tree | 86660ac853a2573678bd2ec909f9ac2cd6d72499 /drivers/hwmon/s3c-hwmon.c | |
parent | bbc8a569ae91e0951f4b7f8eb33ef1970bf2129c (diff) |
hwmon: (s3c-hwmon) Use devm_kzalloc instead of kzalloc
This makes the code simpler as explicit freeing is not needed.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/s3c-hwmon.c')
-rw-r--r-- | drivers/hwmon/s3c-hwmon.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index f6c26d19f521..b7975f858cff 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c | |||
@@ -288,7 +288,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) | |||
288 | return -EINVAL; | 288 | return -EINVAL; |
289 | } | 289 | } |
290 | 290 | ||
291 | hwmon = kzalloc(sizeof(struct s3c_hwmon), GFP_KERNEL); | 291 | hwmon = devm_kzalloc(&dev->dev, sizeof(struct s3c_hwmon), GFP_KERNEL); |
292 | if (hwmon == NULL) { | 292 | if (hwmon == NULL) { |
293 | dev_err(&dev->dev, "no memory\n"); | 293 | dev_err(&dev->dev, "no memory\n"); |
294 | return -ENOMEM; | 294 | return -ENOMEM; |
@@ -303,8 +303,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) | |||
303 | hwmon->client = s3c_adc_register(dev, NULL, NULL, 0); | 303 | hwmon->client = s3c_adc_register(dev, NULL, NULL, 0); |
304 | if (IS_ERR(hwmon->client)) { | 304 | if (IS_ERR(hwmon->client)) { |
305 | dev_err(&dev->dev, "cannot register adc\n"); | 305 | dev_err(&dev->dev, "cannot register adc\n"); |
306 | ret = PTR_ERR(hwmon->client); | 306 | return PTR_ERR(hwmon->client); |
307 | goto err_mem; | ||
308 | } | 307 | } |
309 | 308 | ||
310 | /* add attributes for our adc devices. */ | 309 | /* add attributes for our adc devices. */ |
@@ -363,8 +362,6 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) | |||
363 | err_registered: | 362 | err_registered: |
364 | s3c_adc_release(hwmon->client); | 363 | s3c_adc_release(hwmon->client); |
365 | 364 | ||
366 | err_mem: | ||
367 | kfree(hwmon); | ||
368 | return ret; | 365 | return ret; |
369 | } | 366 | } |
370 | 367 | ||