diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 12:58:10 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:40 -0400 |
commit | 5ff512b458ba7948d22dab0771233cf9b2da0793 (patch) | |
tree | 71a061028eeda2f7c0062167bdb6ab2d18c5f057 /drivers/hwmon | |
parent | 747e5d62ac85b9706739d2e21b1722f68d797da0 (diff) |
hwmon: (lm87) 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/lm87.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index 314d147bf1ac..16e45d702152 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c | |||
@@ -898,11 +898,9 @@ static int lm87_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
898 | struct lm87_data *data; | 898 | struct lm87_data *data; |
899 | int err; | 899 | int err; |
900 | 900 | ||
901 | data = kzalloc(sizeof(struct lm87_data), GFP_KERNEL); | 901 | data = devm_kzalloc(&client->dev, sizeof(struct lm87_data), GFP_KERNEL); |
902 | if (!data) { | 902 | if (!data) |
903 | err = -ENOMEM; | 903 | return -ENOMEM; |
904 | goto exit; | ||
905 | } | ||
906 | 904 | ||
907 | i2c_set_clientdata(client, data); | 905 | i2c_set_clientdata(client, data); |
908 | data->valid = 0; | 906 | data->valid = 0; |
@@ -923,7 +921,7 @@ static int lm87_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
923 | /* Register sysfs hooks */ | 921 | /* Register sysfs hooks */ |
924 | err = sysfs_create_group(&client->dev.kobj, &lm87_group); | 922 | err = sysfs_create_group(&client->dev.kobj, &lm87_group); |
925 | if (err) | 923 | if (err) |
926 | goto exit_free; | 924 | goto exit_stop; |
927 | 925 | ||
928 | if (data->channel & CHAN_NO_FAN(0)) { | 926 | if (data->channel & CHAN_NO_FAN(0)) { |
929 | err = sysfs_create_group(&client->dev.kobj, &lm87_group_in6); | 927 | err = sysfs_create_group(&client->dev.kobj, &lm87_group_in6); |
@@ -972,10 +970,8 @@ static int lm87_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
972 | 970 | ||
973 | exit_remove: | 971 | exit_remove: |
974 | lm87_remove_files(client); | 972 | lm87_remove_files(client); |
975 | exit_free: | 973 | exit_stop: |
976 | lm87_write_value(client, LM87_REG_CONFIG, data->config); | 974 | lm87_write_value(client, LM87_REG_CONFIG, data->config); |
977 | kfree(data); | ||
978 | exit: | ||
979 | return err; | 975 | return err; |
980 | } | 976 | } |
981 | 977 | ||
@@ -987,7 +983,6 @@ static int lm87_remove(struct i2c_client *client) | |||
987 | lm87_remove_files(client); | 983 | lm87_remove_files(client); |
988 | 984 | ||
989 | lm87_write_value(client, LM87_REG_CONFIG, data->config); | 985 | lm87_write_value(client, LM87_REG_CONFIG, data->config); |
990 | kfree(data); | ||
991 | return 0; | 986 | return 0; |
992 | } | 987 | } |
993 | 988 | ||