Re: [PATCH 23/39] hwmon: (lm70) Convert to use devm_ functions

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

 



On Tue,  7 Aug 2012 08:20:12 -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/lm70.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
> index 472f795..dd7f0ca 100644
> --- a/drivers/hwmon/lm70.c
> +++ b/drivers/hwmon/lm70.c
> @@ -149,7 +149,7 @@ static int __devinit lm70_probe(struct spi_device *spi)
>  
>  	/* NOTE:  we assume 8-bit words, and convert to 16 bits manually */
>  
> -	p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
> +	p_lm70 = devm_kzalloc(&spi->dev, sizeof(*p_lm70), GFP_KERNEL);
>  	if (!p_lm70)
>  		return -ENOMEM;
>  
> @@ -181,7 +181,6 @@ out_dev_create_file_failed:
>  	device_remove_file(&spi->dev, &dev_attr_temp1_input);
>  out_dev_create_temp_file_failed:
>  	spi_set_drvdata(spi, NULL);
> -	kfree(p_lm70);
>  	return status;
>  }
>  
> @@ -193,7 +192,6 @@ static int __devexit lm70_remove(struct spi_device *spi)
>  	device_remove_file(&spi->dev, &dev_attr_temp1_input);
>  	device_remove_file(&spi->dev, &dev_attr_name);
>  	spi_set_drvdata(spi, NULL);
> -	kfree(p_lm70);
>  
>  	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