diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 09:57:58 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-21 21:48:38 -0700 |
commit | 6702c9981e92aeb5cbfc192d23c11ef0f26b6157 (patch) | |
tree | 405cab9274dee096656c051fa57812e1612cec52 /drivers/hwmon/adm1025.c | |
parent | 61d4d17ea9dc3624eeb2b235059c9c30578b81ae (diff) | |
download | linux-stable-6702c9981e92aeb5cbfc192d23c11ef0f26b6157.tar.gz linux-stable-6702c9981e92aeb5cbfc192d23c11ef0f26b6157.tar.bz2 linux-stable-6702c9981e92aeb5cbfc192d23c11ef0f26b6157.zip |
hwmon: (adm1025) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/adm1025.c')
-rw-r--r-- | drivers/hwmon/adm1025.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index b8557f9857d2..7e16e5d07bc6 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -477,11 +477,10 @@ static int adm1025_probe(struct i2c_client *client, int err; u8 config; - data = kzalloc(sizeof(struct adm1025_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct adm1025_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); mutex_init(&data->update_lock); @@ -492,7 +491,7 @@ static int adm1025_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &adm1025_group); if (err) - goto exit_free; + return err; /* Pin 11 is either in4 (+12V) or VID4 */ config = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG); @@ -513,9 +512,6 @@ static int adm1025_probe(struct i2c_client *client, exit_remove: sysfs_remove_group(&client->dev.kobj, &adm1025_group); sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); -exit_free: - kfree(data); -exit: return err; } @@ -569,7 +565,6 @@ static int adm1025_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &adm1025_group); sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); - kfree(data); return 0; } |