From c5a4a91d24e0d4af8630932081a4c9a15e7fb1f7 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sat, 2 Jun 2012 09:58:08 -0700 Subject: hwmon: (lm63) Convert to use devm_ functions Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck Acked-by: Jean Delvare --- drivers/hwmon/lm63.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 602a0f0b0de..eed4d940178 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -1108,11 +1108,9 @@ static int lm63_probe(struct i2c_client *client, struct lm63_data *data; int err; - data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct lm63_data), GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); data->valid = 0; @@ -1129,7 +1127,7 @@ static int lm63_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &lm63_group); if (err) - goto exit_free; + return err; if (data->config & 0x04) { /* tachometer enabled */ err = sysfs_create_group(&client->dev.kobj, &lm63_group_fan1); if (err) @@ -1161,9 +1159,6 @@ exit_remove_files: device_remove_file(&client->dev, &dev_attr_temp2_type); sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut); } -exit_free: - kfree(data); -exit: return err; } @@ -1179,7 +1174,6 @@ static int lm63_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut); } - kfree(data); return 0; } -- cgit v1.2.3-70-g09d2