All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hans J. Koch" <hjk@hansjkoch.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 61/95] hwmon: (max6650) Convert to use devm_ functions
Date: Fri, 15 Jun 2012 16:22:12 +0000	[thread overview]
Message-ID: <20120615162212.GC13597@local> (raw)
In-Reply-To: <1339773856-3443-62-git-send-email-linux@roeck-us.net>

On Fri, Jun 15, 2012 at 08:23:42AM -0700, Guenter Roeck wrote:
> Convert to use devm_ functions to reduce code size and simplify the code.
> 
> Cc: Hans J. Koch <hjk@hansjkoch.de>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>

> ---
>  drivers/hwmon/max6650.c |   10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
> index 33a8a7f..f739f83 100644
> --- a/drivers/hwmon/max6650.c
> +++ b/drivers/hwmon/max6650.c
> @@ -545,7 +545,8 @@ static int max6650_probe(struct i2c_client *client,
>  	struct max6650_data *data;
>  	int err;
>  
> -	data = kzalloc(sizeof(struct max6650_data), GFP_KERNEL);
> +	data = devm_kzalloc(&client->dev, sizeof(struct max6650_data),
> +			    GFP_KERNEL);
>  	if (!data) {
>  		dev_err(&client->dev, "out of memory.\n");
>  		return -ENOMEM;
> @@ -560,11 +561,11 @@ static int max6650_probe(struct i2c_client *client,
>  	 */
>  	err = max6650_init_client(client);
>  	if (err)
> -		goto err_free;
> +		return err;
>  
>  	err = sysfs_create_group(&client->dev.kobj, &max6650_attr_grp);
>  	if (err)
> -		goto err_free;
> +		return err;
>  	/* 3 additional fan inputs for the MAX6651 */
>  	if (data->nr_fans = 4) {
>  		err = sysfs_create_group(&client->dev.kobj, &max6651_attr_grp);
> @@ -582,8 +583,6 @@ static int max6650_probe(struct i2c_client *client,
>  		sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp);
>  err_remove:
>  	sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp);
> -err_free:
> -	kfree(data);
>  	return err;
>  }
>  
> @@ -595,7 +594,6 @@ static int max6650_remove(struct i2c_client *client)
>  	if (data->nr_fans = 4)
>  		sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp);
>  	sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp);
> -	kfree(data);
>  	return 0;
>  }
>  
> -- 
> 1.7.9.7
> 
> 

_______________________________________________
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:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 15:23 [lm-sensors] [PATCH 61/95] hwmon: (max6650) Convert to use devm_ functions Guenter Roeck
2012-06-15 16:22 ` Hans J. Koch [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=20120615162212.GC13597@local \
    --to=hjk@hansjkoch.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.