All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 76/95] hwmon: (tmp102) Convert to use devm_ functions
@ 2012-06-15 15:23 Guenter Roeck
  2012-06-17 11:50 ` Jean Delvare
  2012-06-17 14:35 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-06-15 15:23 UTC (permalink / raw)
  To: lm-sensors

Convert to use devm_ functions to reduce code size and simplify the code.

Signed-off-by: Guenter Roeck <linux@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");
 		return -ENOMEM;
 	}
 	i2c_set_clientdata(client, tmp102);
@@ -169,7 +169,7 @@ static int __devinit tmp102_probe(struct i2c_client *client,
 	status = i2c_smbus_read_word_swapped(client, TMP102_CONF_REG);
 	if (status < 0) {
 		dev_err(&client->dev, "error reading config register\n");
-		goto fail_free;
+		return status;
 	}
 	tmp102->config_orig = status;
 	status = i2c_smbus_write_word_swapped(client, TMP102_CONF_REG,
@@ -213,9 +213,6 @@ fail_remove_sysfs:
 fail_restore_config:
 	i2c_smbus_write_word_swapped(client, TMP102_CONF_REG,
 				     tmp102->config_orig);
-fail_free:
-	kfree(tmp102);
-
 	return status;
 }
 
@@ -236,8 +233,6 @@ static int __devexit tmp102_remove(struct i2c_client *client)
 						     config | TMP102_CONF_SD);
 	}
 
-	kfree(tmp102);
-
 	return 0;
 }
 
-- 
1.7.9.7


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [lm-sensors] [PATCH 76/95] hwmon: (tmp102) Convert to use devm_ functions
  2012-06-15 15:23 [lm-sensors] [PATCH 76/95] hwmon: (tmp102) Convert to use devm_ functions Guenter Roeck
@ 2012-06-17 11:50 ` Jean Delvare
  2012-06-17 14:35 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2012-06-17 11:50 UTC (permalink / raw)
  To: lm-sensors

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@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@linux-fr.org>

-- 
Jean Delvare

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [lm-sensors] [PATCH 76/95] hwmon: (tmp102) Convert to use devm_ functions
  2012-06-15 15:23 [lm-sensors] [PATCH 76/95] hwmon: (tmp102) Convert to use devm_ functions Guenter Roeck
  2012-06-17 11:50 ` Jean Delvare
@ 2012-06-17 14:35 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-06-17 14:35 UTC (permalink / raw)
  To: lm-sensors

On Sun, Jun 17, 2012 at 01:50:07PM +0200, Jean Delvare wrote:
> 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@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.)
> 
I dropped it.

> In any case:
> 
> Acked-by: Jean Delvare <khali@linux-fr.org>
> 
Thanks,
Guenter

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-17 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15 15:23 [lm-sensors] [PATCH 76/95] hwmon: (tmp102) Convert to use devm_ functions Guenter Roeck
2012-06-17 11:50 ` Jean Delvare
2012-06-17 14:35 ` Guenter Roeck

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.