diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-09-24 15:24:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:19 -0400 |
commit | a5ebe668add5f76ed8f01f752b37cfa164a26a30 (patch) | |
tree | 116324063bd55666d0fa23db4342d5bd097518be /drivers/hwmon/via686a.c | |
parent | f52f79da2908796a0fa1e7bbbe0d5ff20183d75f (diff) |
hwmon: Fix unchecked return status, batch 6
hwmon: Fix unchecked return status, batch 6
Fix up 5 more 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/via686a.c')
-rw-r--r-- | drivers/hwmon/via686a.c | 83 |
1 files changed, 50 insertions, 33 deletions
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 95ae056e5a94..f8acada0537a 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/err.h> | 40 | #include <linux/err.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/sysfs.h> | ||
43 | #include <asm/io.h> | 44 | #include <asm/io.h> |
44 | 45 | ||
45 | 46 | ||
@@ -570,6 +571,48 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
570 | } | 571 | } |
571 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 572 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
572 | 573 | ||
574 | static struct attribute *via686a_attributes[] = { | ||
575 | &dev_attr_in0_input.attr, | ||
576 | &dev_attr_in1_input.attr, | ||
577 | &dev_attr_in2_input.attr, | ||
578 | &dev_attr_in3_input.attr, | ||
579 | &dev_attr_in4_input.attr, | ||
580 | &dev_attr_in0_min.attr, | ||
581 | &dev_attr_in1_min.attr, | ||
582 | &dev_attr_in2_min.attr, | ||
583 | &dev_attr_in3_min.attr, | ||
584 | &dev_attr_in4_min.attr, | ||
585 | &dev_attr_in0_max.attr, | ||
586 | &dev_attr_in1_max.attr, | ||
587 | &dev_attr_in2_max.attr, | ||
588 | &dev_attr_in3_max.attr, | ||
589 | &dev_attr_in4_max.attr, | ||
590 | |||
591 | &dev_attr_temp1_input.attr, | ||
592 | &dev_attr_temp2_input.attr, | ||
593 | &dev_attr_temp3_input.attr, | ||
594 | &dev_attr_temp1_max.attr, | ||
595 | &dev_attr_temp2_max.attr, | ||
596 | &dev_attr_temp3_max.attr, | ||
597 | &dev_attr_temp1_max_hyst.attr, | ||
598 | &dev_attr_temp2_max_hyst.attr, | ||
599 | &dev_attr_temp3_max_hyst.attr, | ||
600 | |||
601 | &dev_attr_fan1_input.attr, | ||
602 | &dev_attr_fan2_input.attr, | ||
603 | &dev_attr_fan1_min.attr, | ||
604 | &dev_attr_fan2_min.attr, | ||
605 | &dev_attr_fan1_div.attr, | ||
606 | &dev_attr_fan2_div.attr, | ||
607 | |||
608 | &dev_attr_alarms.attr, | ||
609 | NULL | ||
610 | }; | ||
611 | |||
612 | static const struct attribute_group via686a_group = { | ||
613 | .attrs = via686a_attributes, | ||
614 | }; | ||
615 | |||
573 | /* The driver. I choose to use type i2c_driver, as at is identical to both | 616 | /* The driver. I choose to use type i2c_driver, as at is identical to both |
574 | smbus_driver and isa_driver, and clients could be of either kind */ | 617 | smbus_driver and isa_driver, and clients could be of either kind */ |
575 | static struct i2c_driver via686a_driver = { | 618 | static struct i2c_driver via686a_driver = { |
@@ -650,46 +693,19 @@ static int via686a_detect(struct i2c_adapter *adapter) | |||
650 | via686a_init_client(new_client); | 693 | via686a_init_client(new_client); |
651 | 694 | ||
652 | /* Register sysfs hooks */ | 695 | /* Register sysfs hooks */ |
696 | if ((err = sysfs_create_group(&new_client->dev.kobj, &via686a_group))) | ||
697 | goto exit_detach; | ||
698 | |||
653 | data->class_dev = hwmon_device_register(&new_client->dev); | 699 | data->class_dev = hwmon_device_register(&new_client->dev); |
654 | if (IS_ERR(data->class_dev)) { | 700 | if (IS_ERR(data->class_dev)) { |
655 | err = PTR_ERR(data->class_dev); | 701 | err = PTR_ERR(data->class_dev); |
656 | goto exit_detach; | 702 | goto exit_remove_files; |
657 | } | 703 | } |
658 | 704 | ||
659 | device_create_file(&new_client->dev, &dev_attr_in0_input); | ||
660 | device_create_file(&new_client->dev, &dev_attr_in1_input); | ||
661 | device_create_file(&new_client->dev, &dev_attr_in2_input); | ||
662 | device_create_file(&new_client->dev, &dev_attr_in3_input); | ||
663 | device_create_file(&new_client->dev, &dev_attr_in4_input); | ||
664 | device_create_file(&new_client->dev, &dev_attr_in0_min); | ||
665 | device_create_file(&new_client->dev, &dev_attr_in1_min); | ||
666 | device_create_file(&new_client->dev, &dev_attr_in2_min); | ||
667 | device_create_file(&new_client->dev, &dev_attr_in3_min); | ||
668 | device_create_file(&new_client->dev, &dev_attr_in4_min); | ||
669 | device_create_file(&new_client->dev, &dev_attr_in0_max); | ||
670 | device_create_file(&new_client->dev, &dev_attr_in1_max); | ||
671 | device_create_file(&new_client->dev, &dev_attr_in2_max); | ||
672 | device_create_file(&new_client->dev, &dev_attr_in3_max); | ||
673 | device_create_file(&new_client->dev, &dev_attr_in4_max); | ||
674 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
675 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | ||
676 | device_create_file(&new_client->dev, &dev_attr_temp3_input); | ||
677 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
678 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | ||
679 | device_create_file(&new_client->dev, &dev_attr_temp3_max); | ||
680 | device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst); | ||
681 | device_create_file(&new_client->dev, &dev_attr_temp2_max_hyst); | ||
682 | device_create_file(&new_client->dev, &dev_attr_temp3_max_hyst); | ||
683 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | ||
684 | device_create_file(&new_client->dev, &dev_attr_fan2_input); | ||
685 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | ||
686 | device_create_file(&new_client->dev, &dev_attr_fan2_min); | ||
687 | device_create_file(&new_client->dev, &dev_attr_fan1_div); | ||
688 | device_create_file(&new_client->dev, &dev_attr_fan2_div); | ||
689 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
690 | |||
691 | return 0; | 705 | return 0; |
692 | 706 | ||
707 | exit_remove_files: | ||
708 | sysfs_remove_group(&new_client->dev.kobj, &via686a_group); | ||
693 | exit_detach: | 709 | exit_detach: |
694 | i2c_detach_client(new_client); | 710 | i2c_detach_client(new_client); |
695 | exit_free: | 711 | exit_free: |
@@ -705,6 +721,7 @@ static int via686a_detach_client(struct i2c_client *client) | |||
705 | int err; | 721 | int err; |
706 | 722 | ||
707 | hwmon_device_unregister(data->class_dev); | 723 | hwmon_device_unregister(data->class_dev); |
724 | sysfs_remove_group(&client->dev.kobj, &via686a_group); | ||
708 | 725 | ||
709 | if ((err = i2c_detach_client(client))) | 726 | if ((err = i2c_detach_client(client))) |
710 | return err; | 727 | return err; |