All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 06/39] hwmon: (adcxx) Convert to use devm_ functions
@ 2012-08-07 15:19 Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2012-08-07 15:19 UTC (permalink / raw)
  To: lm-sensors

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

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/adcxx.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index a3d3183..111af7c 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -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;
 }
 
@@ -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;
 }
-- 
1.7.9.7


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [lm-sensors] [PATCH 06/39] hwmon: (adcxx) Convert to use devm_ functions
@ 2012-09-17 19:23 Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2012-09-17 19:23 UTC (permalink / raw)
  To: lm-sensors

On Tue,  7 Aug 2012 08:19:55 -0700, Guenter Roeck wrote:
> Convert to use devm_ functions to reduce code size and simplify the code.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/hwmon/adcxx.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
> index a3d3183..111af7c 100644
> --- a/drivers/hwmon/adcxx.c
> +++ b/drivers/hwmon/adcxx.c
> @@ -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;
>  }
>  
> @@ -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;
>  }

Acked-by: Jean Delvare <khali@linux-fr.org>

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-17 19:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-07 15:19 [lm-sensors] [PATCH 06/39] hwmon: (adcxx) Convert to use devm_ functions Guenter Roeck
2012-09-17 19:23 Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.