From: Guenter Roeck Date: Sat, 2 Jun 2012 18:48:02 +0000 (-0700) Subject: hwmon: (w83l786ng) Convert to use devm_ functions X-Git-Tag: next-20120914~85^2~19 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ce27d91fc4c145b22f3e69dbf935c012713bca62;p=karo-tx-linux.git 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 --- diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index 5850b7706088..c99c8a0473cf 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c @@ -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); @@ -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; } @@ -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; }