Re: [PATCH 06/39] hwmon: (adcxx) Convert to use devm_ functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxx>

-- 
Jean Delvare

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


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux