summaryrefslogtreecommitdiff
path: root/drivers/hwmon/w83795.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 22:48:01 +0400
committerGuenter Roeck <linux@roeck-us.net>2012-07-22 08:48:39 +0400
commit4cb14a3a6545bf4c51d6b61b95ccc1afe59510c9 (patch)
treeb489d7437002fc8a5e5ef57cb503c21fb15c472c /drivers/hwmon/w83795.c
parent20f426ff028202b2c0df947a3468ed4717f598d6 (diff)
downloadlinux-4cb14a3a6545bf4c51d6b61b95ccc1afe59510c9.tar.xz
hwmon: (w83795) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r--drivers/hwmon/w83795.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index d887cb3b72e8..b813c646c7ca 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -2157,11 +2157,9 @@ static int w83795_probe(struct i2c_client *client,
struct w83795_data *data;
int err;
- data = kzalloc(sizeof(struct w83795_data), GFP_KERNEL);
- if (!data) {
- err = -ENOMEM;
- goto exit;
- }
+ data = devm_kzalloc(dev, sizeof(struct w83795_data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
i2c_set_clientdata(client, data);
data->chip_type = id->driver_data;
@@ -2247,8 +2245,6 @@ static int w83795_probe(struct i2c_client *client,
exit_remove:
w83795_handle_files(dev, device_remove_file_wrapper);
- kfree(data);
-exit:
return err;
}
@@ -2258,7 +2254,6 @@ static int w83795_remove(struct i2c_client *client)
hwmon_device_unregister(data->hwmon_dev);
w83795_handle_files(&client->dev, device_remove_file_wrapper);
- kfree(data);
return 0;
}