aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83l785ts.c
diff options
context:
space:
mode:
authorRudolf Marek <r.marek@assembler.cz>2006-09-24 15:23:26 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:18 -0400
commitccc5c306957bb7fbaef61de249bac4b0f09f2336 (patch)
tree484101b931764f176ce027566b35cb7a93a6749b /drivers/hwmon/w83l785ts.c
parent311ce2efb1b640584676fc1b0b7f16c5baf85eb8 (diff)
w83l785ts: Fix unchecked return status
w83l785ts: Fix unchecked return status Fix the w83l785ts driver. Add error checking to device_create_file and also care to destroy the files upon exit. Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/w83l785ts.c')
-rw-r--r--drivers/hwmon/w83l785ts.c28
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
253exit_detach: 258exit_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);
255exit_free: 264exit_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