diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 12:58:11 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:41 -0400 |
commit | 4a8ad25af56fa55746a97c4f48985154eb82a842 (patch) | |
tree | 64b6e2be557c8251d0e5cbb2384147d258b01a6c /drivers/hwmon/lm93.c | |
parent | 705375cc41f2bd63dfffcf4830afff76c63e5681 (diff) |
hwmon: (lm93) 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>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm93.c')
-rw-r--r-- | drivers/hwmon/lm93.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c index 67e8fe256e02..bf946187bd37 100644 --- a/drivers/hwmon/lm93.c +++ b/drivers/hwmon/lm93.c | |||
@@ -2738,15 +2738,13 @@ static int lm93_probe(struct i2c_client *client, | |||
2738 | } else { | 2738 | } else { |
2739 | dev_dbg(&client->dev, "detect failed, " | 2739 | dev_dbg(&client->dev, "detect failed, " |
2740 | "smbus byte and/or word data not supported!\n"); | 2740 | "smbus byte and/or word data not supported!\n"); |
2741 | err = -ENODEV; | 2741 | return -ENODEV; |
2742 | goto err_out; | ||
2743 | } | 2742 | } |
2744 | 2743 | ||
2745 | data = kzalloc(sizeof(struct lm93_data), GFP_KERNEL); | 2744 | data = devm_kzalloc(&client->dev, sizeof(struct lm93_data), GFP_KERNEL); |
2746 | if (!data) { | 2745 | if (!data) { |
2747 | dev_dbg(&client->dev, "out of memory!\n"); | 2746 | dev_dbg(&client->dev, "out of memory!\n"); |
2748 | err = -ENOMEM; | 2747 | return -ENOMEM; |
2749 | goto err_out; | ||
2750 | } | 2748 | } |
2751 | i2c_set_clientdata(client, data); | 2749 | i2c_set_clientdata(client, data); |
2752 | 2750 | ||
@@ -2760,7 +2758,7 @@ static int lm93_probe(struct i2c_client *client, | |||
2760 | 2758 | ||
2761 | err = sysfs_create_group(&client->dev.kobj, &lm93_attr_grp); | 2759 | err = sysfs_create_group(&client->dev.kobj, &lm93_attr_grp); |
2762 | if (err) | 2760 | if (err) |
2763 | goto err_free; | 2761 | return err; |
2764 | 2762 | ||
2765 | /* Register hwmon driver class */ | 2763 | /* Register hwmon driver class */ |
2766 | data->hwmon_dev = hwmon_device_register(&client->dev); | 2764 | data->hwmon_dev = hwmon_device_register(&client->dev); |
@@ -2770,9 +2768,6 @@ static int lm93_probe(struct i2c_client *client, | |||
2770 | err = PTR_ERR(data->hwmon_dev); | 2768 | err = PTR_ERR(data->hwmon_dev); |
2771 | dev_err(&client->dev, "error registering hwmon device.\n"); | 2769 | dev_err(&client->dev, "error registering hwmon device.\n"); |
2772 | sysfs_remove_group(&client->dev.kobj, &lm93_attr_grp); | 2770 | sysfs_remove_group(&client->dev.kobj, &lm93_attr_grp); |
2773 | err_free: | ||
2774 | kfree(data); | ||
2775 | err_out: | ||
2776 | return err; | 2771 | return err; |
2777 | } | 2772 | } |
2778 | 2773 | ||
@@ -2783,7 +2778,6 @@ static int lm93_remove(struct i2c_client *client) | |||
2783 | hwmon_device_unregister(data->hwmon_dev); | 2778 | hwmon_device_unregister(data->hwmon_dev); |
2784 | sysfs_remove_group(&client->dev.kobj, &lm93_attr_grp); | 2779 | sysfs_remove_group(&client->dev.kobj, &lm93_attr_grp); |
2785 | 2780 | ||
2786 | kfree(data); | ||
2787 | return 0; | 2781 | return 0; |
2788 | } | 2782 | } |
2789 | 2783 | ||