aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1031.c
diff options
context:
space:
mode:
authorMark M. Hoffman <mhoffman@lightlink.com>2006-09-24 15:15:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:17 -0400
commit681c6f7a6702f208d48b501c8829dbc03a2ca238 (patch)
treeedeba1565c69b4be8e3aeb73df97ccea05fce66c /drivers/hwmon/adm1031.c
parent0501a3816e5b778830fc2157a6d6bb11a965fc2c (diff)
hwmon: Fix unchecked return status, batch 3
hwmon: Fix unchecked return status, batch 3 Fix up some hwmon drivers so that they no longer ignore return status from device_create_file(). Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/adm1031.c')
-rw-r--r--drivers/hwmon/adm1031.c114
1 files changed, 70 insertions, 44 deletions
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 3bf2da621aed..122683fc91d0 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -730,6 +730,61 @@ static int adm1031_attach_adapter(struct i2c_adapter *adapter)
730 return i2c_probe(adapter, &addr_data, adm1031_detect); 730 return i2c_probe(adapter, &addr_data, adm1031_detect);
731} 731}
732 732
733static struct attribute *adm1031_attributes[] = {
734 &dev_attr_fan1_input.attr,
735 &dev_attr_fan1_div.attr,
736 &dev_attr_fan1_min.attr,
737 &dev_attr_pwm1.attr,
738 &dev_attr_auto_fan1_channel.attr,
739 &dev_attr_temp1_input.attr,
740 &dev_attr_temp1_min.attr,
741 &dev_attr_temp1_max.attr,
742 &dev_attr_temp1_crit.attr,
743 &dev_attr_temp2_input.attr,
744 &dev_attr_temp2_min.attr,
745 &dev_attr_temp2_max.attr,
746 &dev_attr_temp2_crit.attr,
747
748 &dev_attr_auto_temp1_off.attr,
749 &dev_attr_auto_temp1_min.attr,
750 &dev_attr_auto_temp1_max.attr,
751
752 &dev_attr_auto_temp2_off.attr,
753 &dev_attr_auto_temp2_min.attr,
754 &dev_attr_auto_temp2_max.attr,
755
756 &dev_attr_auto_fan1_min_pwm.attr,
757
758 &dev_attr_alarms.attr,
759
760 NULL
761};
762
763static const struct attribute_group adm1031_group = {
764 .attrs = adm1031_attributes,
765};
766
767static struct attribute *adm1031_attributes_opt[] = {
768 &dev_attr_fan2_input.attr,
769 &dev_attr_fan2_div.attr,
770 &dev_attr_fan2_min.attr,
771 &dev_attr_pwm2.attr,
772 &dev_attr_auto_fan2_channel.attr,
773 &dev_attr_temp3_input.attr,
774 &dev_attr_temp3_min.attr,
775 &dev_attr_temp3_max.attr,
776 &dev_attr_temp3_crit.attr,
777 &dev_attr_auto_temp3_off.attr,
778 &dev_attr_auto_temp3_min.attr,
779 &dev_attr_auto_temp3_max.attr,
780 &dev_attr_auto_fan2_min_pwm.attr,
781 NULL
782};
783
784static const struct attribute_group adm1031_group_opt = {
785 .attrs = adm1031_attributes_opt,
786};
787
733/* This function is called by i2c_probe */ 788/* This function is called by i2c_probe */
734static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind) 789static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
735{ 790{
@@ -789,57 +844,26 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
789 adm1031_init_client(new_client); 844 adm1031_init_client(new_client);
790 845
791 /* Register sysfs hooks */ 846 /* Register sysfs hooks */
792 data->class_dev = hwmon_device_register(&new_client->dev); 847 if ((err = sysfs_create_group(&new_client->dev.kobj, &adm1031_group)))
793 if (IS_ERR(data->class_dev)) {
794 err = PTR_ERR(data->class_dev);
795 goto exit_detach; 848 goto exit_detach;
796 }
797
798 device_create_file(&new_client->dev, &dev_attr_fan1_input);
799 device_create_file(&new_client->dev, &dev_attr_fan1_div);
800 device_create_file(&new_client->dev, &dev_attr_fan1_min);
801 device_create_file(&new_client->dev, &dev_attr_pwm1);
802 device_create_file(&new_client->dev, &dev_attr_auto_fan1_channel);
803 device_create_file(&new_client->dev, &dev_attr_temp1_input);
804 device_create_file(&new_client->dev, &dev_attr_temp1_min);
805 device_create_file(&new_client->dev, &dev_attr_temp1_max);
806 device_create_file(&new_client->dev, &dev_attr_temp1_crit);
807 device_create_file(&new_client->dev, &dev_attr_temp2_input);
808 device_create_file(&new_client->dev, &dev_attr_temp2_min);
809 device_create_file(&new_client->dev, &dev_attr_temp2_max);
810 device_create_file(&new_client->dev, &dev_attr_temp2_crit);
811
812 device_create_file(&new_client->dev, &dev_attr_auto_temp1_off);
813 device_create_file(&new_client->dev, &dev_attr_auto_temp1_min);
814 device_create_file(&new_client->dev, &dev_attr_auto_temp1_max);
815
816 device_create_file(&new_client->dev, &dev_attr_auto_temp2_off);
817 device_create_file(&new_client->dev, &dev_attr_auto_temp2_min);
818 device_create_file(&new_client->dev, &dev_attr_auto_temp2_max);
819
820 device_create_file(&new_client->dev, &dev_attr_auto_fan1_min_pwm);
821
822 device_create_file(&new_client->dev, &dev_attr_alarms);
823 849
824 if (kind == adm1031) { 850 if (kind == adm1031) {
825 device_create_file(&new_client->dev, &dev_attr_fan2_input); 851 if ((err = sysfs_create_group(&new_client->dev.kobj,
826 device_create_file(&new_client->dev, &dev_attr_fan2_div); 852 &adm1031_group_opt)))
827 device_create_file(&new_client->dev, &dev_attr_fan2_min); 853 goto exit_remove;
828 device_create_file(&new_client->dev, &dev_attr_pwm2); 854 }
829 device_create_file(&new_client->dev, 855
830 &dev_attr_auto_fan2_channel); 856 data->class_dev = hwmon_device_register(&new_client->dev);
831 device_create_file(&new_client->dev, &dev_attr_temp3_input); 857 if (IS_ERR(data->class_dev)) {
832 device_create_file(&new_client->dev, &dev_attr_temp3_min); 858 err = PTR_ERR(data->class_dev);
833 device_create_file(&new_client->dev, &dev_attr_temp3_max); 859 goto exit_remove;
834 device_create_file(&new_client->dev, &dev_attr_temp3_crit);
835 device_create_file(&new_client->dev, &dev_attr_auto_temp3_off);
836 device_create_file(&new_client->dev, &dev_attr_auto_temp3_min);
837 device_create_file(&new_client->dev, &dev_attr_auto_temp3_max);
838 device_create_file(&new_client->dev, &dev_attr_auto_fan2_min_pwm);
839 } 860 }
840 861
841 return 0; 862 return 0;
842 863
864exit_remove:
865 sysfs_remove_group(&new_client->dev.kobj, &adm1031_group);
866 sysfs_remove_group(&new_client->dev.kobj, &adm1031_group_opt);
843exit_detach: 867exit_detach:
844 i2c_detach_client(new_client); 868 i2c_detach_client(new_client);
845exit_free: 869exit_free:
@@ -854,6 +878,8 @@ static int adm1031_detach_client(struct i2c_client *client)
854 int ret; 878 int ret;
855 879
856 hwmon_device_unregister(data->class_dev); 880 hwmon_device_unregister(data->class_dev);
881 sysfs_remove_group(&client->dev.kobj, &adm1031_group);
882 sysfs_remove_group(&client->dev.kobj, &adm1031_group_opt);
857 if ((ret = i2c_detach_client(client)) != 0) { 883 if ((ret = i2c_detach_client(client)) != 0) {
858 return ret; 884 return ret;
859 } 885 }