Commit 41bf870e authored by Sachin Kamat's avatar Sachin Kamat Committed by Guenter Roeck

hwmon: (s3c-hwmon) Use devm_kzalloc instead of kzalloc

This makes the code simpler as explicit freeing is not needed.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent bbc8a569
...@@ -288,7 +288,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) ...@@ -288,7 +288,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
return -EINVAL; return -EINVAL;
} }
hwmon = kzalloc(sizeof(struct s3c_hwmon), GFP_KERNEL); hwmon = devm_kzalloc(&dev->dev, sizeof(struct s3c_hwmon), GFP_KERNEL);
if (hwmon == NULL) { if (hwmon == NULL) {
dev_err(&dev->dev, "no memory\n"); dev_err(&dev->dev, "no memory\n");
return -ENOMEM; return -ENOMEM;
...@@ -303,8 +303,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) ...@@ -303,8 +303,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
hwmon->client = s3c_adc_register(dev, NULL, NULL, 0); hwmon->client = s3c_adc_register(dev, NULL, NULL, 0);
if (IS_ERR(hwmon->client)) { if (IS_ERR(hwmon->client)) {
dev_err(&dev->dev, "cannot register adc\n"); dev_err(&dev->dev, "cannot register adc\n");
ret = PTR_ERR(hwmon->client); return PTR_ERR(hwmon->client);
goto err_mem;
} }
/* add attributes for our adc devices. */ /* add attributes for our adc devices. */
...@@ -363,8 +362,6 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) ...@@ -363,8 +362,6 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
err_registered: err_registered:
s3c_adc_release(hwmon->client); s3c_adc_release(hwmon->client);
err_mem:
kfree(hwmon);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment