Skip to contentSkip to conversation

hwmon: (s3c-hwmon) Convert to use devm_ functions

PATCH Superseded Guenter Roeck 1 participant 1 message Jun 15, 2012 Hardware monitoring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 69/95 hwmon: (s3c-hwmon) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.

---
 drivers/hwmon/s3c-hwmon.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/hwmon/s3c-hwmon.c +2 -6
index f6c26d1..717f809 100644
@@ -288,7 +288,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
 		return -EINVAL;
 	}
 
-	hwmon = kzalloc(sizeof(struct s3c_hwmon), GFP_KERNEL);
+	hwmon = devm_kzalloc(&dev->dev, sizeof(struct s3c_hwmon), GFP_KERNEL);
 	if (hwmon = NULL) {
 		dev_err(&dev->dev, "no memory\n");
 		return -ENOMEM;
@@ -303,8 +303,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
 	hwmon->client = s3c_adc_register(dev, NULL, NULL, 0);
 	if (IS_ERR(hwmon->client)) {
 		dev_err(&dev->dev, "cannot register adc\n");
-		ret = PTR_ERR(hwmon->client);
-		goto err_mem;
+		return PTR_ERR(hwmon->client);
 	}
 
 	/* add attributes for our adc devices. */
@@ -362,9 +361,6 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
 
  err_registered:
 	s3c_adc_release(hwmon->client);
-
- err_mem:
-	kfree(hwmon);
 	return ret;
 }
 
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors