mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-05 22:25:16 +00:00
hwmon: (adt7475) 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>
This commit is contained in:
parent
6702c9981e
commit
e3ecb2eeed
1 changed files with 2 additions and 5 deletions
|
@ -1260,7 +1260,7 @@ static int adt7475_probe(struct i2c_client *client,
|
||||||
int i, ret = 0, revision;
|
int i, ret = 0, revision;
|
||||||
u8 config2, config3;
|
u8 config2, config3;
|
||||||
|
|
||||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1344,7 +1344,7 @@ static int adt7475_probe(struct i2c_client *client,
|
||||||
|
|
||||||
ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group);
|
ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto efree;
|
return ret;
|
||||||
|
|
||||||
/* Features that can be disabled individually */
|
/* Features that can be disabled individually */
|
||||||
if (data->has_fan4) {
|
if (data->has_fan4) {
|
||||||
|
@ -1410,8 +1410,6 @@ static int adt7475_probe(struct i2c_client *client,
|
||||||
|
|
||||||
eremove:
|
eremove:
|
||||||
adt7475_remove_files(client, data);
|
adt7475_remove_files(client, data);
|
||||||
efree:
|
|
||||||
kfree(data);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1421,7 +1419,6 @@ static int adt7475_remove(struct i2c_client *client)
|
||||||
|
|
||||||
hwmon_device_unregister(data->hwmon_dev);
|
hwmon_device_unregister(data->hwmon_dev);
|
||||||
adt7475_remove_files(client, data);
|
adt7475_remove_files(client, data);
|
||||||
kfree(data);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue