diff options
-rw-r--r-- | drivers/hwmon/w83l785ts.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index 3f2bac125fb1..a3fcace412f0 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
@@ -236,21 +236,30 @@ static int w83l785ts_detect(struct i2c_adapter *adapter, int address, int kind) | |||
236 | * Nothing yet, assume it is already started. | 236 | * Nothing yet, assume it is already started. |
237 | */ | 237 | */ |
238 | 238 | ||
239 | err = device_create_file(&new_client->dev, | ||
240 | &sensor_dev_attr_temp1_input.dev_attr); | ||
241 | if (err) | ||
242 | goto exit_remove; | ||
243 | |||
244 | err = device_create_file(&new_client->dev, | ||
245 | &sensor_dev_attr_temp1_max.dev_attr); | ||
246 | if (err) | ||
247 | goto exit_remove; | ||
248 | |||
239 | /* Register sysfs hooks */ | 249 | /* Register sysfs hooks */ |
240 | data->class_dev = hwmon_device_register(&new_client->dev); | 250 | data->class_dev = hwmon_device_register(&new_client->dev); |
241 | if (IS_ERR(data->class_dev)) { | 251 | if (IS_ERR(data->class_dev)) { |
242 | err = PTR_ERR(data->class_dev); | 252 | err = PTR_ERR(data->class_dev); |
243 | goto exit_detach; | 253 | goto exit_remove; |
244 | } | 254 | } |
245 | 255 | ||
246 | device_create_file(&new_client->dev, | ||
247 | &sensor_dev_attr_temp1_input.dev_attr); | ||
248 | device_create_file(&new_client->dev, | ||
249 | &sensor_dev_attr_temp1_max.dev_attr); | ||
250 | |||
251 | return 0; | 256 | return 0; |
252 | 257 | ||
253 | exit_detach: | 258 | exit_remove: |
259 | device_remove_file(&new_client->dev, | ||
260 | &sensor_dev_attr_temp1_input.dev_attr); | ||
261 | device_remove_file(&new_client->dev, | ||
262 | &sensor_dev_attr_temp1_max.dev_attr); | ||
254 | i2c_detach_client(new_client); | 263 | i2c_detach_client(new_client); |
255 | exit_free: | 264 | exit_free: |
256 | kfree(data); | 265 | kfree(data); |
@@ -264,7 +273,10 @@ static int w83l785ts_detach_client(struct i2c_client *client) | |||
264 | int err; | 273 | int err; |
265 | 274 | ||
266 | hwmon_device_unregister(data->class_dev); | 275 | hwmon_device_unregister(data->class_dev); |
267 | 276 | device_remove_file(&client->dev, | |
277 | &sensor_dev_attr_temp1_input.dev_attr); | ||
278 | device_remove_file(&client->dev, | ||
279 | &sensor_dev_attr_temp1_max.dev_attr); | ||
268 | if ((err = i2c_detach_client(client))) | 280 | if ((err = i2c_detach_client(client))) |
269 | return err; | 281 | return err; |
270 | 282 | ||