aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm63.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 12:58:08 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-07-22 00:48:40 -0400
commitc5a4a91d24e0d4af8630932081a4c9a15e7fb1f7 (patch)
treea708ecfb51331b46e08072c7217afdc20343c769 /drivers/hwmon/lm63.c
parent647ff514d8a099fcce029283c1ecc38519b218d6 (diff)
hwmon: (lm63) 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/lm63.c')
-rw-r--r--drivers/hwmon/lm63.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index 602a0f0b0de8..eed4d9401788 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -1108,11 +1108,9 @@ static int lm63_probe(struct i2c_client *client,
1108 struct lm63_data *data; 1108 struct lm63_data *data;
1109 int err; 1109 int err;
1110 1110
1111 data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL); 1111 data = devm_kzalloc(&client->dev, sizeof(struct lm63_data), GFP_KERNEL);
1112 if (!data) { 1112 if (!data)
1113 err = -ENOMEM; 1113 return -ENOMEM;
1114 goto exit;
1115 }
1116 1114
1117 i2c_set_clientdata(client, data); 1115 i2c_set_clientdata(client, data);
1118 data->valid = 0; 1116 data->valid = 0;
@@ -1129,7 +1127,7 @@ static int lm63_probe(struct i2c_client *client,
1129 /* Register sysfs hooks */ 1127 /* Register sysfs hooks */
1130 err = sysfs_create_group(&client->dev.kobj, &lm63_group); 1128 err = sysfs_create_group(&client->dev.kobj, &lm63_group);
1131 if (err) 1129 if (err)
1132 goto exit_free; 1130 return err;
1133 if (data->config & 0x04) { /* tachometer enabled */ 1131 if (data->config & 0x04) { /* tachometer enabled */
1134 err = sysfs_create_group(&client->dev.kobj, &lm63_group_fan1); 1132 err = sysfs_create_group(&client->dev.kobj, &lm63_group_fan1);
1135 if (err) 1133 if (err)
@@ -1161,9 +1159,6 @@ exit_remove_files:
1161 device_remove_file(&client->dev, &dev_attr_temp2_type); 1159 device_remove_file(&client->dev, &dev_attr_temp2_type);
1162 sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut); 1160 sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut);
1163 } 1161 }
1164exit_free:
1165 kfree(data);
1166exit:
1167 return err; 1162 return err;
1168} 1163}
1169 1164
@@ -1179,7 +1174,6 @@ static int lm63_remove(struct i2c_client *client)
1179 sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut); 1174 sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut);
1180 } 1175 }
1181 1176
1182 kfree(data);
1183 return 0; 1177 return 0;
1184} 1178}
1185 1179