hwmon: (asc7621) Convert to use devm_ functions
Subsystems (2)
Guenter Roeck
maintainerPATCH 23/95 hwmon: (asc7621) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Cc George Joseph <[email protected]>
Signed-off-by Guenter Roeck <[email protected]>
--- drivers/hwmon/asc7621.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/hwmon/asc7621.c +2 -3
@@ -1109,7 +1109,8 @@ asc7621_probe(struct i2c_client *client, const struct i2c_device_id *id)if (!i2c_check_functionality (client->adapter,I2C_FUNC_SMBUS_BYTE_DATA ))return -EIO ; - data =kzalloc (sizeof (struct asc7621_data ),GFP_KERNEL ); + data =devm_kzalloc (&client->dev,sizeof (struct asc7621_data ), +GFP_KERNEL );if (data =NULL )return -ENOMEM ;
@@ -1143,7 +1144,6 @@ exit_remove: &(asc7621_params[i].sda.dev_attr)); } -kfree (data);return err; }
@@ -1192,7 +1192,6 @@ static int asc7621_remove(struct i2c_client *client) &(asc7621_params[i].sda.dev_attr)); } -kfree (data);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 5 lines · Guenter Roeck
Convert to use
devm_functions to reduce code size and simplify the code.Cc George Joseph <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Acked-by George Joseph <[email protected]>
Thanks Guenter!
Quoted 37 lines
---
drivers/hwmon/asc7621.c | 5 ++---1 file changed, 2 insertions(+), 3 deletions(-)drivers/hwmon/asc7621.c +2
-1@@ -1109,7 +1109,8 @@ asc7621_probe(struct i2c_client *client, const struct i2c_device_id *id) if (!i2c_check_functionality(client->adapter,I2C_FUNC_SMBUS_BYTE_DATA )) return -EIO; - data = kzalloc(sizeof(struct asc7621_data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(struct asc7621_data), + GFP_KERNEL); if (data == NULL)return
-ENOMEM;drivers/hwmon/asc7621.c +0
-3@@ -1143,7 +1144,6 @@ exit_remove: &(asc7621_params[i].sda.dev_attr)); } - kfree(data); return err; }@@ -1192,7 +1192,6 @@ static int asc7621_remove(struct i2c_client *client) &(asc7621_params[i].sda.dev_attr)); } - kfree(data); return 0; } --
Quoted 2 lines
1.7.9.7
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors