diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 15:04:07 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:43 -0400 |
commit | 2625996b7556f4b23ff73a8280e867372ab54bc4 (patch) | |
tree | 2cec70cd7bba72a24003a54dd0389af9c1ebf68c /drivers/hwmon | |
parent | 08ad7c9522c22eea1912d41ee9418154b8760ea9 (diff) |
hwmon: (smsc47m192) 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/smsc47m192.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c index 4705a8bf11c2..36a3478d0799 100644 --- a/drivers/hwmon/smsc47m192.c +++ b/drivers/hwmon/smsc47m192.c | |||
@@ -554,11 +554,10 @@ static int smsc47m192_probe(struct i2c_client *client, | |||
554 | int config; | 554 | int config; |
555 | int err; | 555 | int err; |
556 | 556 | ||
557 | data = kzalloc(sizeof(struct smsc47m192_data), GFP_KERNEL); | 557 | data = devm_kzalloc(&client->dev, sizeof(struct smsc47m192_data), |
558 | if (!data) { | 558 | GFP_KERNEL); |
559 | err = -ENOMEM; | 559 | if (!data) |
560 | goto exit; | 560 | return -ENOMEM; |
561 | } | ||
562 | 561 | ||
563 | i2c_set_clientdata(client, data); | 562 | i2c_set_clientdata(client, data); |
564 | data->vrm = vid_which_vrm(); | 563 | data->vrm = vid_which_vrm(); |
@@ -570,7 +569,7 @@ static int smsc47m192_probe(struct i2c_client *client, | |||
570 | /* Register sysfs hooks */ | 569 | /* Register sysfs hooks */ |
571 | err = sysfs_create_group(&client->dev.kobj, &smsc47m192_group); | 570 | err = sysfs_create_group(&client->dev.kobj, &smsc47m192_group); |
572 | if (err) | 571 | if (err) |
573 | goto exit_free; | 572 | return err; |
574 | 573 | ||
575 | /* Pin 110 is either in4 (+12V) or VID4 */ | 574 | /* Pin 110 is either in4 (+12V) or VID4 */ |
576 | config = i2c_smbus_read_byte_data(client, SMSC47M192_REG_CONFIG); | 575 | config = i2c_smbus_read_byte_data(client, SMSC47M192_REG_CONFIG); |
@@ -592,9 +591,6 @@ static int smsc47m192_probe(struct i2c_client *client, | |||
592 | exit_remove_files: | 591 | exit_remove_files: |
593 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group); | 592 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group); |
594 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group_in4); | 593 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group_in4); |
595 | exit_free: | ||
596 | kfree(data); | ||
597 | exit: | ||
598 | return err; | 594 | return err; |
599 | } | 595 | } |
600 | 596 | ||
@@ -606,8 +602,6 @@ static int smsc47m192_remove(struct i2c_client *client) | |||
606 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group); | 602 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group); |
607 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group_in4); | 603 | sysfs_remove_group(&client->dev.kobj, &smsc47m192_group_in4); |
608 | 604 | ||
609 | kfree(data); | ||
610 | |||
611 | return 0; | 605 | return 0; |
612 | } | 606 | } |
613 | 607 | ||