Skip to contentSkip to conversation

hwmon: (adcxx) Convert to use devm_ functions

PATCH Jean Delvare 1 participant 1 message Sep 17, 2012

lore
Share & tools
lore

Jean Delvare

author Acked-by
#0 lore raw
Quoted 29 lines · Guenter Roeck

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

---
 drivers/hwmon/adcxx.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hwmon/adcxx.c +1 -2
index a3d3183..111af7c 100644
@@ -171,7 +171,7 @@ static int __devinit adcxx_probe(struct spi_device *spi)
 	int status;
 	int i;
 
-	adc = kzalloc(sizeof *adc, GFP_KERNEL);
+	adc = devm_kzalloc(&spi->dev, sizeof(*adc), GFP_KERNEL);
 	if (!adc)
 		return -ENOMEM;
 
@@ -208,7 +208,6 @@ out_err:
 
 	spi_set_drvdata(spi, NULL);
 	mutex_unlock(&adc->lock);
-	kfree(adc);
 	return status;
 }
 

drivers/hwmon/adcxx.c static int __devexit adcxx_remove(struct spi_device *spi) · line 228

Quoted 7 lines
drivers/hwmon/adcxx.c +0 -1
@@ -224,7 +223,6 @@ static int __devexit adcxx_remove(struct spi_device *spi)
 
 	spi_set_drvdata(spi, NULL);
 	mutex_unlock(&adc->lock);
-	kfree(adc);
 
 	return 0;
 }
Signature · 6 lines
Jean Delvare

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