[lm-sensors] [PATCH 76/95] hwmon: (tmp102) Convert to use devm_ functions

Jean Delvare khali at linux-fr.org
Sun Jun 17 13:50:07 CEST 2012


On Fri, 15 Jun 2012 08:23:57 -0700, Guenter Roeck wrote:
> Convert to use devm_ functions to reduce code size and simplify the code.
> 
> Signed-off-by: Guenter Roeck <linux at roeck-us.net>
> ---
>  drivers/hwmon/tmp102.c |   11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
> index 0d466b9..b6cda09 100644
> --- a/drivers/hwmon/tmp102.c
> +++ b/drivers/hwmon/tmp102.c
> @@ -159,9 +159,9 @@ static int __devinit tmp102_probe(struct i2c_client *client,
>  		return -ENODEV;
>  	}
>  
> -	tmp102 = kzalloc(sizeof(*tmp102), GFP_KERNEL);
> +	tmp102 = devm_kzalloc(&client->dev, sizeof(*tmp102), GFP_KERNEL);
>  	if (!tmp102) {
> -		dev_dbg(&client->dev, "kzalloc failed\n");
> +		dev_dbg(&client->dev, "devm_kzalloc failed\n");

I'd think it's not worth updating these messages, devm_kzalloc is just
one flavor of kzalloc.

(These messages are useless anyway, as explained in a previous review.)

In any case:

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

-- 
Jean Delvare




More information about the lm-sensors mailing list