diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 12:57:58 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:38 -0400 |
commit | 6702c9981e92aeb5cbfc192d23c11ef0f26b6157 (patch) | |
tree | 405cab9274dee096656c051fa57812e1612cec52 /drivers/hwmon/adm1025.c | |
parent | 61d4d17ea9dc3624eeb2b235059c9c30578b81ae (diff) |
hwmon: (adm1025) 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/adm1025.c')
-rw-r--r-- | drivers/hwmon/adm1025.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index b8557f9857d2..7e16e5d07bc6 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c | |||
@@ -477,11 +477,10 @@ static int adm1025_probe(struct i2c_client *client, | |||
477 | int err; | 477 | int err; |
478 | u8 config; | 478 | u8 config; |
479 | 479 | ||
480 | data = kzalloc(sizeof(struct adm1025_data), GFP_KERNEL); | 480 | data = devm_kzalloc(&client->dev, sizeof(struct adm1025_data), |
481 | if (!data) { | 481 | GFP_KERNEL); |
482 | err = -ENOMEM; | 482 | if (!data) |
483 | goto exit; | 483 | return -ENOMEM; |
484 | } | ||
485 | 484 | ||
486 | i2c_set_clientdata(client, data); | 485 | i2c_set_clientdata(client, data); |
487 | mutex_init(&data->update_lock); | 486 | mutex_init(&data->update_lock); |
@@ -492,7 +491,7 @@ static int adm1025_probe(struct i2c_client *client, | |||
492 | /* Register sysfs hooks */ | 491 | /* Register sysfs hooks */ |
493 | err = sysfs_create_group(&client->dev.kobj, &adm1025_group); | 492 | err = sysfs_create_group(&client->dev.kobj, &adm1025_group); |
494 | if (err) | 493 | if (err) |
495 | goto exit_free; | 494 | return err; |
496 | 495 | ||
497 | /* Pin 11 is either in4 (+12V) or VID4 */ | 496 | /* Pin 11 is either in4 (+12V) or VID4 */ |
498 | config = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG); | 497 | config = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG); |
@@ -513,9 +512,6 @@ static int adm1025_probe(struct i2c_client *client, | |||
513 | exit_remove: | 512 | exit_remove: |
514 | sysfs_remove_group(&client->dev.kobj, &adm1025_group); | 513 | sysfs_remove_group(&client->dev.kobj, &adm1025_group); |
515 | sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); | 514 | sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); |
516 | exit_free: | ||
517 | kfree(data); | ||
518 | exit: | ||
519 | return err; | 515 | return err; |
520 | } | 516 | } |
521 | 517 | ||
@@ -569,7 +565,6 @@ static int adm1025_remove(struct i2c_client *client) | |||
569 | sysfs_remove_group(&client->dev.kobj, &adm1025_group); | 565 | sysfs_remove_group(&client->dev.kobj, &adm1025_group); |
570 | sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); | 566 | sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); |
571 | 567 | ||
572 | kfree(data); | ||
573 | return 0; | 568 | return 0; |
574 | } | 569 | } |
575 | 570 | ||