diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 14:48:01 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:39 -0400 |
commit | 4cb14a3a6545bf4c51d6b61b95ccc1afe59510c9 (patch) | |
tree | b489d7437002fc8a5e5ef57cb503c21fb15c472c /drivers/hwmon/w83795.c | |
parent | 20f426ff028202b2c0df947a3468ed4717f598d6 (diff) |
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.c | 11 |
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, | |||
2157 | struct w83795_data *data; | 2157 | struct w83795_data *data; |
2158 | int err; | 2158 | int err; |
2159 | 2159 | ||
2160 | data = kzalloc(sizeof(struct w83795_data), GFP_KERNEL); | 2160 | data = devm_kzalloc(dev, sizeof(struct w83795_data), GFP_KERNEL); |
2161 | if (!data) { | 2161 | if (!data) |
2162 | err = -ENOMEM; | 2162 | return -ENOMEM; |
2163 | goto exit; | ||
2164 | } | ||
2165 | 2163 | ||
2166 | i2c_set_clientdata(client, data); | 2164 | i2c_set_clientdata(client, data); |
2167 | data->chip_type = id->driver_data; | 2165 | data->chip_type = id->driver_data; |
@@ -2247,8 +2245,6 @@ static int w83795_probe(struct i2c_client *client, | |||
2247 | 2245 | ||
2248 | exit_remove: | 2246 | exit_remove: |
2249 | w83795_handle_files(dev, device_remove_file_wrapper); | 2247 | w83795_handle_files(dev, device_remove_file_wrapper); |
2250 | kfree(data); | ||
2251 | exit: | ||
2252 | return err; | 2248 | return err; |
2253 | } | 2249 | } |
2254 | 2250 | ||
@@ -2258,7 +2254,6 @@ static int w83795_remove(struct i2c_client *client) | |||
2258 | 2254 | ||
2259 | hwmon_device_unregister(data->hwmon_dev); | 2255 | hwmon_device_unregister(data->hwmon_dev); |
2260 | w83795_handle_files(&client->dev, device_remove_file_wrapper); | 2256 | w83795_handle_files(&client->dev, device_remove_file_wrapper); |
2261 | kfree(data); | ||
2262 | 2257 | ||
2263 | return 0; | 2258 | return 0; |
2264 | } | 2259 | } |