aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 14:48:02 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-09-24 00:08:33 -0400
commit816864d9968814c23c12e6601ad7dd1dabb8f994 (patch)
tree701fa62383d248cdf0cd3c8a952a1f2635d6a29c
parent7711f1bd039233464dbde346f4a14a4bb874f77f (diff)
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>
-rw-r--r--drivers/hwmon/w83l786ng.c13
1 files changed, 4 insertions, 9 deletions
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)
668 int i, err = 0; 668 int i, err = 0;
669 u8 reg_tmp; 669 u8 reg_tmp;
670 670
671 data = kzalloc(sizeof(struct w83l786ng_data), GFP_KERNEL); 671 data = devm_kzalloc(&client->dev, sizeof(struct w83l786ng_data),
672 if (!data) { 672 GFP_KERNEL);
673 err = -ENOMEM; 673 if (!data)
674 goto exit; 674 return -ENOMEM;
675 }
676 675
677 i2c_set_clientdata(client, data); 676 i2c_set_clientdata(client, data);
678 mutex_init(&data->update_lock); 677 mutex_init(&data->update_lock);
@@ -708,8 +707,6 @@ w83l786ng_probe(struct i2c_client *client, const struct i2c_device_id *id)
708 707
709exit_remove: 708exit_remove:
710 sysfs_remove_group(&client->dev.kobj, &w83l786ng_group); 709 sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);
711 kfree(data);
712exit:
713 return err; 710 return err;
714} 711}
715 712
@@ -721,8 +718,6 @@ w83l786ng_remove(struct i2c_client *client)
721 hwmon_device_unregister(data->hwmon_dev); 718 hwmon_device_unregister(data->hwmon_dev);
722 sysfs_remove_group(&client->dev.kobj, &w83l786ng_group); 719 sysfs_remove_group(&client->dev.kobj, &w83l786ng_group);
723 720
724 kfree(data);
725
726 return 0; 721 return 0;
727} 722}
728 723