All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Stigge <stigge@antcom.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 59/95] hwmon: (max6639) Convert to use devm_ functions
Date: Fri, 15 Jun 2012 16:34:52 +0000	[thread overview]
Message-ID: <4FDB642C.9070903@antcom.de> (raw)
In-Reply-To: <1339773856-3443-60-git-send-email-linux@roeck-us.net>

On 06/15/2012 05:23 PM, Guenter Roeck wrote:
> Convert to use devm_ functions to reduce code size and simplify the code.
> 
> Cc: Roland Stigge <stigge@antcom.de>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Roland Stigge <stigge@antcom.de>

> ---
>  drivers/hwmon/max6639.c |   17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
> index de8f7ad..6e60036 100644
> --- a/drivers/hwmon/max6639.c
> +++ b/drivers/hwmon/max6639.c
> @@ -548,11 +548,10 @@ static int max6639_probe(struct i2c_client *client,
>  	struct max6639_data *data;
>  	int err;
>  
> -	data = kzalloc(sizeof(struct max6639_data), GFP_KERNEL);
> -	if (!data) {
> -		err = -ENOMEM;
> -		goto exit;
> -	}
> +	data = devm_kzalloc(&client->dev, sizeof(struct max6639_data),
> +			    GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
>  
>  	i2c_set_clientdata(client, data);
>  	mutex_init(&data->update_lock);
> @@ -560,12 +559,12 @@ static int max6639_probe(struct i2c_client *client,
>  	/* Initialize the max6639 chip */
>  	err = max6639_init_client(client);
>  	if (err < 0)
> -		goto error_free;
> +		return err;
>  
>  	/* Register sysfs hooks */
>  	err = sysfs_create_group(&client->dev.kobj, &max6639_group);
>  	if (err)
> -		goto error_free;
> +		return err;
>  
>  	data->hwmon_dev = hwmon_device_register(&client->dev);
>  	if (IS_ERR(data->hwmon_dev)) {
> @@ -579,9 +578,6 @@ static int max6639_probe(struct i2c_client *client,
>  
>  error_remove:
>  	sysfs_remove_group(&client->dev.kobj, &max6639_group);
> -error_free:
> -	kfree(data);
> -exit:
>  	return err;
>  }
>  
> @@ -592,7 +588,6 @@ static int max6639_remove(struct i2c_client *client)
>  	hwmon_device_unregister(data->hwmon_dev);
>  	sysfs_remove_group(&client->dev.kobj, &max6639_group);
>  
> -	kfree(data);
>  	return 0;
>  }
>  


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

      reply	other threads:[~2012-06-15 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 15:23 [lm-sensors] [PATCH 59/95] hwmon: (max6639) Convert to use devm_ functions Guenter Roeck
2012-06-15 16:34 ` Roland Stigge [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FDB642C.9070903@antcom.de \
    --to=stigge@antcom.de \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.