Skip to content

Commit

Permalink
hwmon: (w83l786ng) Convert to use devm_ functions
Browse files Browse the repository at this point in the history
Convert to use devm_ functions to reduce code size and simplify the code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Guenter Roeck committed Sep 24, 2012
1 parent 7711f1b commit 816864d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions drivers/hwmon/w83l786ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,10 @@ w83l786ng_probe(struct i2c_client *client, const struct i2c_device_id *id)
int i, err = 0;
u8 reg_tmp;

data = kzalloc(sizeof(struct w83l786ng_data), GFP_KERNEL);
if (!data) {
err = -ENOMEM;
goto exit;
}
data = devm_kzalloc(&client->dev, sizeof(struct w83l786ng_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;

i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);
Expand Down Expand Up @@ -708,8 +707,6 @@ w83l786ng_probe(struct i2c_client *client, const struct i2c_device_id *id)

exit_remove:
sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);
kfree(data);
exit:
return err;
}

Expand All @@ -721,8 +718,6 @@ w83l786ng_remove(struct i2c_client *client)
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);

kfree(data);

return 0;
}

Expand Down

0 comments on commit 816864d

Please sign in to comment.