mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-07 04:09:21 +00:00
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>
This commit is contained in:
parent
bba636d059
commit
647ff514d8
1 changed files with 5 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue