hwmon: (w83l786ng) 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>
This commit is contained in:
parent
7711f1bd03
commit
816864d996
|
@ -668,11 +668,10 @@ w83l786ng_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||||
int i, err = 0;
|
int i, err = 0;
|
||||||
u8 reg_tmp;
|
u8 reg_tmp;
|
||||||
|
|
||||||
data = kzalloc(sizeof(struct w83l786ng_data), GFP_KERNEL);
|
data = devm_kzalloc(&client->dev, sizeof(struct w83l786ng_data),
|
||||||
if (!data) {
|
GFP_KERNEL);
|
||||||
err = -ENOMEM;
|
if (!data)
|
||||||
goto exit;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
i2c_set_clientdata(client, data);
|
i2c_set_clientdata(client, data);
|
||||||
mutex_init(&data->update_lock);
|
mutex_init(&data->update_lock);
|
||||||
|
@ -708,8 +707,6 @@ w83l786ng_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||||
|
|
||||||
exit_remove:
|
exit_remove:
|
||||||
sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);
|
sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);
|
||||||
kfree(data);
|
|
||||||
exit:
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,8 +718,6 @@ w83l786ng_remove(struct i2c_client *client)
|
||||||
hwmon_device_unregister(data->hwmon_dev);
|
hwmon_device_unregister(data->hwmon_dev);
|
||||||
sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);
|
sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);
|
||||||
|
|
||||||
kfree(data);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue