diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 09:58:08 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-21 21:48:40 -0700 |
commit | c5a4a91d24e0d4af8630932081a4c9a15e7fb1f7 (patch) | |
tree | a708ecfb51331b46e08072c7217afdc20343c769 | |
parent | 647ff514d8a099fcce029283c1ecc38519b218d6 (diff) | |
download | linux-c5a4a91d24e0d4af8630932081a4c9a15e7fb1f7.tar.bz2 |
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 <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | drivers/hwmon/lm63.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 602a0f0b0de8..eed4d9401788 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; } |