diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 09:58:07 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-21 21:48:40 -0700 |
commit | 647ff514d8a099fcce029283c1ecc38519b218d6 (patch) | |
tree | b7b16374a8fb3c2844252602f2d4fbab81ba7fea /drivers/hwmon/gl520sm.c | |
parent | bba636d0592e5d33b960ba480459180ad5dc1fdd (diff) | |
download | kernel_goldelico_gta04-647ff514d8a099fcce029283c1ecc38519b218d6.zip kernel_goldelico_gta04-647ff514d8a099fcce029283c1ecc38519b218d6.tar.gz kernel_goldelico_gta04-647ff514d8a099fcce029283c1ecc38519b218d6.tar.bz2 |
hwmon: (gl520sm) 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>
Diffstat (limited to 'drivers/hwmon/gl520sm.c')
-rw-r--r-- | drivers/hwmon/gl520sm.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index 5ff452b..a21ff25 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c @@ -779,11 +779,10 @@ static int gl520_probe(struct i2c_client *client, struct gl520_data *data; int err; - data = kzalloc(sizeof(struct gl520_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct gl520_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); mutex_init(&data->update_lock); @@ -794,7 +793,7 @@ static int gl520_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &gl520_group); if (err) - goto exit_free; + return err; if (data->two_temps) err = sysfs_create_group(&client->dev.kobj, &gl520_group_temp2); @@ -816,9 +815,6 @@ exit_remove_files: sysfs_remove_group(&client->dev.kobj, &gl520_group); sysfs_remove_group(&client->dev.kobj, &gl520_group_in4); sysfs_remove_group(&client->dev.kobj, &gl520_group_temp2); -exit_free: - kfree(data); -exit: return err; } @@ -870,7 +866,6 @@ static int gl520_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &gl520_group_in4); sysfs_remove_group(&client->dev.kobj, &gl520_group_temp2); - kfree(data); return 0; } |