diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-18 11:26:05 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:43 -0400 |
commit | e2730bea0b9951cb8ec0732045f59eea360f5e7c (patch) | |
tree | 317e54043b64a28dd35f3c6b42a559b10fda7add | |
parent | f187fc040b31d9e7ff90be08d3140732a8450bc4 (diff) |
hwmon: (w83l785ts) 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>
-rw-r--r-- | drivers/hwmon/w83l785ts.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index 6d45d23ef752..39dbe990dc10 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
@@ -181,13 +181,11 @@ static int w83l785ts_probe(struct i2c_client *client, | |||
181 | { | 181 | { |
182 | struct w83l785ts_data *data; | 182 | struct w83l785ts_data *data; |
183 | struct device *dev = &client->dev; | 183 | struct device *dev = &client->dev; |
184 | int err = 0; | 184 | int err; |
185 | 185 | ||
186 | data = kzalloc(sizeof(struct w83l785ts_data), GFP_KERNEL); | 186 | data = devm_kzalloc(dev, sizeof(struct w83l785ts_data), GFP_KERNEL); |
187 | if (!data) { | 187 | if (!data) |
188 | err = -ENOMEM; | 188 | return -ENOMEM; |
189 | goto exit; | ||
190 | } | ||
191 | 189 | ||
192 | i2c_set_clientdata(client, data); | 190 | i2c_set_clientdata(client, data); |
193 | data->valid = 0; | 191 | data->valid = 0; |
@@ -203,7 +201,7 @@ static int w83l785ts_probe(struct i2c_client *client, | |||
203 | 201 | ||
204 | err = device_create_file(dev, &sensor_dev_attr_temp1_input.dev_attr); | 202 | err = device_create_file(dev, &sensor_dev_attr_temp1_input.dev_attr); |
205 | if (err) | 203 | if (err) |
206 | goto exit_remove; | 204 | return err; |
207 | 205 | ||
208 | err = device_create_file(dev, &sensor_dev_attr_temp1_max.dev_attr); | 206 | err = device_create_file(dev, &sensor_dev_attr_temp1_max.dev_attr); |
209 | if (err) | 207 | if (err) |
@@ -221,8 +219,6 @@ static int w83l785ts_probe(struct i2c_client *client, | |||
221 | exit_remove: | 219 | exit_remove: |
222 | device_remove_file(dev, &sensor_dev_attr_temp1_input.dev_attr); | 220 | device_remove_file(dev, &sensor_dev_attr_temp1_input.dev_attr); |
223 | device_remove_file(dev, &sensor_dev_attr_temp1_max.dev_attr); | 221 | device_remove_file(dev, &sensor_dev_attr_temp1_max.dev_attr); |
224 | kfree(data); | ||
225 | exit: | ||
226 | return err; | 222 | return err; |
227 | } | 223 | } |
228 | 224 | ||
@@ -236,7 +232,6 @@ static int w83l785ts_remove(struct i2c_client *client) | |||
236 | device_remove_file(&client->dev, | 232 | device_remove_file(&client->dev, |
237 | &sensor_dev_attr_temp1_max.dev_attr); | 233 | &sensor_dev_attr_temp1_max.dev_attr); |
238 | 234 | ||
239 | kfree(data); | ||
240 | return 0; | 235 | return 0; |
241 | } | 236 | } |
242 | 237 | ||