hwmon: (tmp102) Convert to use devm_ functions
Guenter Roeck
maintainerPATCH 76/95 hwmon: (tmp102) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
--- drivers/hwmon/tmp102.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/hwmon/tmp102.c +3 -8
@@ -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 ; }
Signature · 7 lines
1.7.9.7 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 12 lines · Guenter Roeck
Convert to use
devm_functions to reduce code size and simplify the code.Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/tmp102.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/hwmon/tmp102.c +0
-0
drivers/hwmon/tmp102.c static int __devinit tmp102_probe(struct i2c_client *client, · line 164
Quoted 8 lines
drivers/hwmon/tmp102.c +2
-2@@ -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:
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 25 lines · Jean Delvare
Quoted 12 lines · Guenter Roeck
Convert to use
devm_functions to reduce code size and simplify the code.Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/tmp102.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/hwmon/tmp102.c +0
-0drivers/hwmon/tmp102.c static int __devinit tmp102_probe(struct i2c_client *client, · line 164
Quoted 8 lines
drivers/hwmon/tmp102.c +2
-2@@ -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_kzallocis just one flavor of kzalloc.
Quoted 2 lines
(These messages are useless anyway, as explained in a previous review.)
I dropped it.
Quoted 4 lines
In any case:
Acked-by Jean Delvare <[email protected]>
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors