diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-09-24 15:17:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:18 -0400 |
commit | 87808be4f97674e6a2982fa835080cc0320dcbdc (patch) | |
tree | c01cc40b9b3710c8692ddbb5641c3ca978dd8cc9 /drivers/hwmon/gl518sm.c | |
parent | 0e39e01c908fdc498fff0d788fd7b955ab75ebb6 (diff) |
Fix unchecked return status, batch 5
hwmon: Fix unchecked return status, batch 5
Fix up some hwmon drivers so that they no longer ignore return status
from device_create_file().
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/gl518sm.c')
-rw-r--r-- | drivers/hwmon/gl518sm.c | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 6606aabdb49d..c103640455a3 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/hwmon.h> | 44 | #include <linux/hwmon.h> |
45 | #include <linux/err.h> | 45 | #include <linux/err.h> |
46 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
47 | #include <linux/sysfs.h> | ||
47 | 48 | ||
48 | /* Addresses to scan */ | 49 | /* Addresses to scan */ |
49 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; | 50 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; |
@@ -340,6 +341,42 @@ static DEVICE_ATTR(beep_enable, S_IWUSR|S_IRUGO, | |||
340 | static DEVICE_ATTR(beep_mask, S_IWUSR|S_IRUGO, | 341 | static DEVICE_ATTR(beep_mask, S_IWUSR|S_IRUGO, |
341 | show_beep_mask, set_beep_mask); | 342 | show_beep_mask, set_beep_mask); |
342 | 343 | ||
344 | static struct attribute *gl518_attributes[] = { | ||
345 | &dev_attr_in0_input.attr, | ||
346 | &dev_attr_in1_input.attr, | ||
347 | &dev_attr_in2_input.attr, | ||
348 | &dev_attr_in3_input.attr, | ||
349 | &dev_attr_in0_min.attr, | ||
350 | &dev_attr_in1_min.attr, | ||
351 | &dev_attr_in2_min.attr, | ||
352 | &dev_attr_in3_min.attr, | ||
353 | &dev_attr_in0_max.attr, | ||
354 | &dev_attr_in1_max.attr, | ||
355 | &dev_attr_in2_max.attr, | ||
356 | &dev_attr_in3_max.attr, | ||
357 | |||
358 | &dev_attr_fan1_auto.attr, | ||
359 | &dev_attr_fan1_input.attr, | ||
360 | &dev_attr_fan2_input.attr, | ||
361 | &dev_attr_fan1_min.attr, | ||
362 | &dev_attr_fan2_min.attr, | ||
363 | &dev_attr_fan1_div.attr, | ||
364 | &dev_attr_fan2_div.attr, | ||
365 | |||
366 | &dev_attr_temp1_input.attr, | ||
367 | &dev_attr_temp1_max.attr, | ||
368 | &dev_attr_temp1_max_hyst.attr, | ||
369 | |||
370 | &dev_attr_alarms.attr, | ||
371 | &dev_attr_beep_enable.attr, | ||
372 | &dev_attr_beep_mask.attr, | ||
373 | NULL | ||
374 | }; | ||
375 | |||
376 | static const struct attribute_group gl518_group = { | ||
377 | .attrs = gl518_attributes, | ||
378 | }; | ||
379 | |||
343 | /* | 380 | /* |
344 | * Real code | 381 | * Real code |
345 | */ | 382 | */ |
@@ -420,43 +457,19 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) | |||
420 | gl518_init_client((struct i2c_client *) new_client); | 457 | gl518_init_client((struct i2c_client *) new_client); |
421 | 458 | ||
422 | /* Register sysfs hooks */ | 459 | /* Register sysfs hooks */ |
460 | if ((err = sysfs_create_group(&new_client->dev.kobj, &gl518_group))) | ||
461 | goto exit_detach; | ||
462 | |||
423 | data->class_dev = hwmon_device_register(&new_client->dev); | 463 | data->class_dev = hwmon_device_register(&new_client->dev); |
424 | if (IS_ERR(data->class_dev)) { | 464 | if (IS_ERR(data->class_dev)) { |
425 | err = PTR_ERR(data->class_dev); | 465 | err = PTR_ERR(data->class_dev); |
426 | goto exit_detach; | 466 | goto exit_remove_files; |
427 | } | 467 | } |
428 | 468 | ||
429 | device_create_file(&new_client->dev, &dev_attr_in0_input); | ||
430 | device_create_file(&new_client->dev, &dev_attr_in1_input); | ||
431 | device_create_file(&new_client->dev, &dev_attr_in2_input); | ||
432 | device_create_file(&new_client->dev, &dev_attr_in3_input); | ||
433 | device_create_file(&new_client->dev, &dev_attr_in0_min); | ||
434 | device_create_file(&new_client->dev, &dev_attr_in1_min); | ||
435 | device_create_file(&new_client->dev, &dev_attr_in2_min); | ||
436 | device_create_file(&new_client->dev, &dev_attr_in3_min); | ||
437 | device_create_file(&new_client->dev, &dev_attr_in0_max); | ||
438 | device_create_file(&new_client->dev, &dev_attr_in1_max); | ||
439 | device_create_file(&new_client->dev, &dev_attr_in2_max); | ||
440 | device_create_file(&new_client->dev, &dev_attr_in3_max); | ||
441 | device_create_file(&new_client->dev, &dev_attr_fan1_auto); | ||
442 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | ||
443 | device_create_file(&new_client->dev, &dev_attr_fan2_input); | ||
444 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | ||
445 | device_create_file(&new_client->dev, &dev_attr_fan2_min); | ||
446 | device_create_file(&new_client->dev, &dev_attr_fan1_div); | ||
447 | device_create_file(&new_client->dev, &dev_attr_fan2_div); | ||
448 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
449 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
450 | device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst); | ||
451 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
452 | device_create_file(&new_client->dev, &dev_attr_beep_enable); | ||
453 | device_create_file(&new_client->dev, &dev_attr_beep_mask); | ||
454 | |||
455 | return 0; | 469 | return 0; |
456 | 470 | ||
457 | /* OK, this is not exactly good programming practice, usually. But it is | 471 | exit_remove_files: |
458 | very code-efficient in this case. */ | 472 | sysfs_remove_group(&new_client->dev.kobj, &gl518_group); |
459 | |||
460 | exit_detach: | 473 | exit_detach: |
461 | i2c_detach_client(new_client); | 474 | i2c_detach_client(new_client); |
462 | exit_free: | 475 | exit_free: |
@@ -490,6 +503,7 @@ static int gl518_detach_client(struct i2c_client *client) | |||
490 | int err; | 503 | int err; |
491 | 504 | ||
492 | hwmon_device_unregister(data->class_dev); | 505 | hwmon_device_unregister(data->class_dev); |
506 | sysfs_remove_group(&client->dev.kobj, &gl518_group); | ||
493 | 507 | ||
494 | if ((err = i2c_detach_client(client))) | 508 | if ((err = i2c_detach_client(client))) |
495 | return err; | 509 | return err; |