aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/fscpos.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-09-24 15:17:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:18 -0400
commit87808be4f97674e6a2982fa835080cc0320dcbdc (patch)
treec01cc40b9b3710c8692ddbb5641c3ca978dd8cc9 /drivers/hwmon/fscpos.c
parent0e39e01c908fdc498fff0d788fd7b955ab75ebb6 (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/fscpos.c')
-rw-r--r--drivers/hwmon/fscpos.c75
1 files changed, 46 insertions, 29 deletions
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c
index 6dc4846b9eeb..ea506a77f9c9 100644
--- a/drivers/hwmon/fscpos.c
+++ b/drivers/hwmon/fscpos.c
@@ -38,6 +38,7 @@
38#include <linux/hwmon.h> 38#include <linux/hwmon.h>
39#include <linux/err.h> 39#include <linux/err.h>
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41#include <linux/sysfs.h>
41 42
42/* 43/*
43 * Addresses to scan 44 * Addresses to scan
@@ -432,6 +433,44 @@ static DEVICE_ATTR(in0_input, S_IRUGO, show_volt_12, NULL);
432static DEVICE_ATTR(in1_input, S_IRUGO, show_volt_5, NULL); 433static DEVICE_ATTR(in1_input, S_IRUGO, show_volt_5, NULL);
433static DEVICE_ATTR(in2_input, S_IRUGO, show_volt_batt, NULL); 434static DEVICE_ATTR(in2_input, S_IRUGO, show_volt_batt, NULL);
434 435
436static struct attribute *fscpos_attributes[] = {
437 &dev_attr_event.attr,
438 &dev_attr_in0_input.attr,
439 &dev_attr_in1_input.attr,
440 &dev_attr_in2_input.attr,
441
442 &dev_attr_wdog_control.attr,
443 &dev_attr_wdog_preset.attr,
444 &dev_attr_wdog_state.attr,
445
446 &dev_attr_temp1_input.attr,
447 &dev_attr_temp1_status.attr,
448 &dev_attr_temp1_reset.attr,
449 &dev_attr_temp2_input.attr,
450 &dev_attr_temp2_status.attr,
451 &dev_attr_temp2_reset.attr,
452 &dev_attr_temp3_input.attr,
453 &dev_attr_temp3_status.attr,
454 &dev_attr_temp3_reset.attr,
455
456 &dev_attr_fan1_input.attr,
457 &dev_attr_fan1_status.attr,
458 &dev_attr_fan1_ripple.attr,
459 &dev_attr_pwm1.attr,
460 &dev_attr_fan2_input.attr,
461 &dev_attr_fan2_status.attr,
462 &dev_attr_fan2_ripple.attr,
463 &dev_attr_pwm2.attr,
464 &dev_attr_fan3_input.attr,
465 &dev_attr_fan3_status.attr,
466 &dev_attr_fan3_ripple.attr,
467 NULL
468};
469
470static const struct attribute_group fscpos_group = {
471 .attrs = fscpos_attributes,
472};
473
435static int fscpos_attach_adapter(struct i2c_adapter *adapter) 474static int fscpos_attach_adapter(struct i2c_adapter *adapter)
436{ 475{
437 if (!(adapter->class & I2C_CLASS_HWMON)) 476 if (!(adapter->class & I2C_CLASS_HWMON))
@@ -497,42 +536,19 @@ static int fscpos_detect(struct i2c_adapter *adapter, int address, int kind)
497 dev_info(&new_client->dev, "Found fscpos chip, rev %u\n", data->revision); 536 dev_info(&new_client->dev, "Found fscpos chip, rev %u\n", data->revision);
498 537
499 /* Register sysfs hooks */ 538 /* Register sysfs hooks */
539 if ((err = sysfs_create_group(&new_client->dev.kobj, &fscpos_group)))
540 goto exit_detach;
541
500 data->class_dev = hwmon_device_register(&new_client->dev); 542 data->class_dev = hwmon_device_register(&new_client->dev);
501 if (IS_ERR(data->class_dev)) { 543 if (IS_ERR(data->class_dev)) {
502 err = PTR_ERR(data->class_dev); 544 err = PTR_ERR(data->class_dev);
503 goto exit_detach; 545 goto exit_remove_files;
504 } 546 }
505 547
506 device_create_file(&new_client->dev, &dev_attr_event);
507 device_create_file(&new_client->dev, &dev_attr_in0_input);
508 device_create_file(&new_client->dev, &dev_attr_in1_input);
509 device_create_file(&new_client->dev, &dev_attr_in2_input);
510 device_create_file(&new_client->dev, &dev_attr_wdog_control);
511 device_create_file(&new_client->dev, &dev_attr_wdog_preset);
512 device_create_file(&new_client->dev, &dev_attr_wdog_state);
513 device_create_file(&new_client->dev, &dev_attr_temp1_input);
514 device_create_file(&new_client->dev, &dev_attr_temp1_status);
515 device_create_file(&new_client->dev, &dev_attr_temp1_reset);
516 device_create_file(&new_client->dev, &dev_attr_temp2_input);
517 device_create_file(&new_client->dev, &dev_attr_temp2_status);
518 device_create_file(&new_client->dev, &dev_attr_temp2_reset);
519 device_create_file(&new_client->dev, &dev_attr_temp3_input);
520 device_create_file(&new_client->dev, &dev_attr_temp3_status);
521 device_create_file(&new_client->dev, &dev_attr_temp3_reset);
522 device_create_file(&new_client->dev, &dev_attr_fan1_input);
523 device_create_file(&new_client->dev, &dev_attr_fan1_status);
524 device_create_file(&new_client->dev, &dev_attr_fan1_ripple);
525 device_create_file(&new_client->dev, &dev_attr_pwm1);
526 device_create_file(&new_client->dev, &dev_attr_fan2_input);
527 device_create_file(&new_client->dev, &dev_attr_fan2_status);
528 device_create_file(&new_client->dev, &dev_attr_fan2_ripple);
529 device_create_file(&new_client->dev, &dev_attr_pwm2);
530 device_create_file(&new_client->dev, &dev_attr_fan3_input);
531 device_create_file(&new_client->dev, &dev_attr_fan3_status);
532 device_create_file(&new_client->dev, &dev_attr_fan3_ripple);
533
534 return 0; 548 return 0;
535 549
550exit_remove_files:
551 sysfs_remove_group(&new_client->dev.kobj, &fscpos_group);
536exit_detach: 552exit_detach:
537 i2c_detach_client(new_client); 553 i2c_detach_client(new_client);
538exit_free: 554exit_free:
@@ -547,6 +563,7 @@ static int fscpos_detach_client(struct i2c_client *client)
547 int err; 563 int err;
548 564
549 hwmon_device_unregister(data->class_dev); 565 hwmon_device_unregister(data->class_dev);
566 sysfs_remove_group(&client->dev.kobj, &fscpos_group);
550 567
551 if ((err = i2c_detach_client(client))) 568 if ((err = i2c_detach_client(client)))
552 return err; 569 return err;