diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 12:58:12 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:41 -0400 |
commit | 215690a4f1050cdf3267e72e2d8c9c62d47b7b1f (patch) | |
tree | cfe1173b7d0883d87fa2543740dfb8b27dd8c1fe /drivers/hwmon | |
parent | 661f020f56c698be9cf40f0b3c8963c2d15be0dd (diff) |
hwmon: (max1619) 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')
-rw-r--r-- | drivers/hwmon/max1619.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index ecac04a7b7d6..6c11ec214071 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
@@ -267,11 +267,10 @@ static int max1619_probe(struct i2c_client *new_client, | |||
267 | struct max1619_data *data; | 267 | struct max1619_data *data; |
268 | int err; | 268 | int err; |
269 | 269 | ||
270 | data = kzalloc(sizeof(struct max1619_data), GFP_KERNEL); | 270 | data = devm_kzalloc(&new_client->dev, sizeof(struct max1619_data), |
271 | if (!data) { | 271 | GFP_KERNEL); |
272 | err = -ENOMEM; | 272 | if (!data) |
273 | goto exit; | 273 | return -ENOMEM; |
274 | } | ||
275 | 274 | ||
276 | i2c_set_clientdata(new_client, data); | 275 | i2c_set_clientdata(new_client, data); |
277 | data->valid = 0; | 276 | data->valid = 0; |
@@ -283,7 +282,7 @@ static int max1619_probe(struct i2c_client *new_client, | |||
283 | /* Register sysfs hooks */ | 282 | /* Register sysfs hooks */ |
284 | err = sysfs_create_group(&new_client->dev.kobj, &max1619_group); | 283 | err = sysfs_create_group(&new_client->dev.kobj, &max1619_group); |
285 | if (err) | 284 | if (err) |
286 | goto exit_free; | 285 | return err; |
287 | 286 | ||
288 | data->hwmon_dev = hwmon_device_register(&new_client->dev); | 287 | data->hwmon_dev = hwmon_device_register(&new_client->dev); |
289 | if (IS_ERR(data->hwmon_dev)) { | 288 | if (IS_ERR(data->hwmon_dev)) { |
@@ -295,9 +294,6 @@ static int max1619_probe(struct i2c_client *new_client, | |||
295 | 294 | ||
296 | exit_remove_files: | 295 | exit_remove_files: |
297 | sysfs_remove_group(&new_client->dev.kobj, &max1619_group); | 296 | sysfs_remove_group(&new_client->dev.kobj, &max1619_group); |
298 | exit_free: | ||
299 | kfree(data); | ||
300 | exit: | ||
301 | return err; | 297 | return err; |
302 | } | 298 | } |
303 | 299 | ||
@@ -323,7 +319,6 @@ static int max1619_remove(struct i2c_client *client) | |||
323 | hwmon_device_unregister(data->hwmon_dev); | 319 | hwmon_device_unregister(data->hwmon_dev); |
324 | sysfs_remove_group(&client->dev.kobj, &max1619_group); | 320 | sysfs_remove_group(&client->dev.kobj, &max1619_group); |
325 | 321 | ||
326 | kfree(data); | ||
327 | return 0; | 322 | return 0; |
328 | } | 323 | } |
329 | 324 | ||