diff options
author | Mark M. Hoffman <mhoffman@lightlink.com> | 2006-09-24 14:59:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:17 -0400 |
commit | c1685f61b0a3110b701d09b84a9f9a3d4e9ef2e2 (patch) | |
tree | 8c7f4791ae7c31390ba127d4e0c0d766775819f4 /drivers/hwmon/asb100.c | |
parent | a1fdcb96ee33ba75318476a2a4691147c9f2ad90 (diff) |
hwmon: Fix unchecked return status, batch 1
hwmon: Fix unchecked return status, batch 1
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/asb100.c')
-rw-r--r-- | drivers/hwmon/asb100.c | 122 |
1 files changed, 68 insertions, 54 deletions
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index facc1ccb8338..57b1c7b7ac3f 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
@@ -298,12 +298,6 @@ sysfs_in(4); | |||
298 | sysfs_in(5); | 298 | sysfs_in(5); |
299 | sysfs_in(6); | 299 | sysfs_in(6); |
300 | 300 | ||
301 | #define device_create_file_in(client, offset) do { \ | ||
302 | device_create_file(&client->dev, &dev_attr_in##offset##_input); \ | ||
303 | device_create_file(&client->dev, &dev_attr_in##offset##_min); \ | ||
304 | device_create_file(&client->dev, &dev_attr_in##offset##_max); \ | ||
305 | } while (0) | ||
306 | |||
307 | /* 3 Fans */ | 301 | /* 3 Fans */ |
308 | static ssize_t show_fan(struct device *dev, char *buf, int nr) | 302 | static ssize_t show_fan(struct device *dev, char *buf, int nr) |
309 | { | 303 | { |
@@ -421,12 +415,6 @@ sysfs_fan(1); | |||
421 | sysfs_fan(2); | 415 | sysfs_fan(2); |
422 | sysfs_fan(3); | 416 | sysfs_fan(3); |
423 | 417 | ||
424 | #define device_create_file_fan(client, offset) do { \ | ||
425 | device_create_file(&client->dev, &dev_attr_fan##offset##_input); \ | ||
426 | device_create_file(&client->dev, &dev_attr_fan##offset##_min); \ | ||
427 | device_create_file(&client->dev, &dev_attr_fan##offset##_div); \ | ||
428 | } while (0) | ||
429 | |||
430 | /* 4 Temp. Sensors */ | 418 | /* 4 Temp. Sensors */ |
431 | static int sprintf_temp_from_reg(u16 reg, char *buf, int nr) | 419 | static int sprintf_temp_from_reg(u16 reg, char *buf, int nr) |
432 | { | 420 | { |
@@ -515,12 +503,6 @@ sysfs_temp(3); | |||
515 | sysfs_temp(4); | 503 | sysfs_temp(4); |
516 | 504 | ||
517 | /* VID */ | 505 | /* VID */ |
518 | #define device_create_file_temp(client, num) do { \ | ||
519 | device_create_file(&client->dev, &dev_attr_temp##num##_input); \ | ||
520 | device_create_file(&client->dev, &dev_attr_temp##num##_max); \ | ||
521 | device_create_file(&client->dev, &dev_attr_temp##num##_max_hyst); \ | ||
522 | } while (0) | ||
523 | |||
524 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) | 506 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
525 | { | 507 | { |
526 | struct asb100_data *data = asb100_update_device(dev); | 508 | struct asb100_data *data = asb100_update_device(dev); |
@@ -528,8 +510,6 @@ static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char | |||
528 | } | 510 | } |
529 | 511 | ||
530 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 512 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
531 | #define device_create_file_vid(client) \ | ||
532 | device_create_file(&client->dev, &dev_attr_cpu0_vid) | ||
533 | 513 | ||
534 | /* VRM */ | 514 | /* VRM */ |
535 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) | 515 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -549,8 +529,6 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const | |||
549 | 529 | ||
550 | /* Alarms */ | 530 | /* Alarms */ |
551 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); | 531 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); |
552 | #define device_create_file_vrm(client) \ | ||
553 | device_create_file(&client->dev, &dev_attr_vrm); | ||
554 | 532 | ||
555 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) | 533 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
556 | { | 534 | { |
@@ -559,8 +537,6 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
559 | } | 537 | } |
560 | 538 | ||
561 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 539 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
562 | #define device_create_file_alarms(client) \ | ||
563 | device_create_file(&client->dev, &dev_attr_alarms) | ||
564 | 540 | ||
565 | /* 1 PWM */ | 541 | /* 1 PWM */ |
566 | static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, char *buf) | 542 | static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -607,10 +583,65 @@ static ssize_t set_pwm_enable1(struct device *dev, struct device_attribute *attr | |||
607 | static DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm1, set_pwm1); | 583 | static DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm1, set_pwm1); |
608 | static DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, | 584 | static DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, |
609 | show_pwm_enable1, set_pwm_enable1); | 585 | show_pwm_enable1, set_pwm_enable1); |
610 | #define device_create_file_pwm1(client) do { \ | 586 | |
611 | device_create_file(&new_client->dev, &dev_attr_pwm1); \ | 587 | static struct attribute *asb100_attributes[] = { |
612 | device_create_file(&new_client->dev, &dev_attr_pwm1_enable); \ | 588 | &dev_attr_in0_input.attr, |
613 | } while (0) | 589 | &dev_attr_in0_min.attr, |
590 | &dev_attr_in0_max.attr, | ||
591 | &dev_attr_in1_input.attr, | ||
592 | &dev_attr_in1_min.attr, | ||
593 | &dev_attr_in1_max.attr, | ||
594 | &dev_attr_in2_input.attr, | ||
595 | &dev_attr_in2_min.attr, | ||
596 | &dev_attr_in2_max.attr, | ||
597 | &dev_attr_in3_input.attr, | ||
598 | &dev_attr_in3_min.attr, | ||
599 | &dev_attr_in3_max.attr, | ||
600 | &dev_attr_in4_input.attr, | ||
601 | &dev_attr_in4_min.attr, | ||
602 | &dev_attr_in4_max.attr, | ||
603 | &dev_attr_in5_input.attr, | ||
604 | &dev_attr_in5_min.attr, | ||
605 | &dev_attr_in5_max.attr, | ||
606 | &dev_attr_in6_input.attr, | ||
607 | &dev_attr_in6_min.attr, | ||
608 | &dev_attr_in6_max.attr, | ||
609 | |||
610 | &dev_attr_fan1_input.attr, | ||
611 | &dev_attr_fan1_min.attr, | ||
612 | &dev_attr_fan1_div.attr, | ||
613 | &dev_attr_fan2_input.attr, | ||
614 | &dev_attr_fan2_min.attr, | ||
615 | &dev_attr_fan2_div.attr, | ||
616 | &dev_attr_fan3_input.attr, | ||
617 | &dev_attr_fan3_min.attr, | ||
618 | &dev_attr_fan3_div.attr, | ||
619 | |||
620 | &dev_attr_temp1_input.attr, | ||
621 | &dev_attr_temp1_max.attr, | ||
622 | &dev_attr_temp1_max_hyst.attr, | ||
623 | &dev_attr_temp2_input.attr, | ||
624 | &dev_attr_temp2_max.attr, | ||
625 | &dev_attr_temp2_max_hyst.attr, | ||
626 | &dev_attr_temp3_input.attr, | ||
627 | &dev_attr_temp3_max.attr, | ||
628 | &dev_attr_temp3_max_hyst.attr, | ||
629 | &dev_attr_temp4_input.attr, | ||
630 | &dev_attr_temp4_max.attr, | ||
631 | &dev_attr_temp4_max_hyst.attr, | ||
632 | |||
633 | &dev_attr_cpu0_vid.attr, | ||
634 | &dev_attr_vrm.attr, | ||
635 | &dev_attr_alarms.attr, | ||
636 | &dev_attr_pwm1.attr, | ||
637 | &dev_attr_pwm1_enable.attr, | ||
638 | |||
639 | NULL | ||
640 | }; | ||
641 | |||
642 | static const struct attribute_group asb100_group = { | ||
643 | .attrs = asb100_attributes, | ||
644 | }; | ||
614 | 645 | ||
615 | /* This function is called when: | 646 | /* This function is called when: |
616 | asb100_driver is inserted (when this module is loaded), for each | 647 | asb100_driver is inserted (when this module is loaded), for each |
@@ -810,38 +841,19 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | |||
810 | data->fan_min[2] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(2)); | 841 | data->fan_min[2] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(2)); |
811 | 842 | ||
812 | /* Register sysfs hooks */ | 843 | /* Register sysfs hooks */ |
844 | if ((err = sysfs_create_group(&new_client->dev.kobj, &asb100_group))) | ||
845 | goto ERROR3; | ||
846 | |||
813 | data->class_dev = hwmon_device_register(&new_client->dev); | 847 | data->class_dev = hwmon_device_register(&new_client->dev); |
814 | if (IS_ERR(data->class_dev)) { | 848 | if (IS_ERR(data->class_dev)) { |
815 | err = PTR_ERR(data->class_dev); | 849 | err = PTR_ERR(data->class_dev); |
816 | goto ERROR3; | 850 | goto ERROR4; |
817 | } | 851 | } |
818 | 852 | ||
819 | device_create_file_in(new_client, 0); | ||
820 | device_create_file_in(new_client, 1); | ||
821 | device_create_file_in(new_client, 2); | ||
822 | device_create_file_in(new_client, 3); | ||
823 | device_create_file_in(new_client, 4); | ||
824 | device_create_file_in(new_client, 5); | ||
825 | device_create_file_in(new_client, 6); | ||
826 | |||
827 | device_create_file_fan(new_client, 1); | ||
828 | device_create_file_fan(new_client, 2); | ||
829 | device_create_file_fan(new_client, 3); | ||
830 | |||
831 | device_create_file_temp(new_client, 1); | ||
832 | device_create_file_temp(new_client, 2); | ||
833 | device_create_file_temp(new_client, 3); | ||
834 | device_create_file_temp(new_client, 4); | ||
835 | |||
836 | device_create_file_vid(new_client); | ||
837 | device_create_file_vrm(new_client); | ||
838 | |||
839 | device_create_file_alarms(new_client); | ||
840 | |||
841 | device_create_file_pwm1(new_client); | ||
842 | |||
843 | return 0; | 853 | return 0; |
844 | 854 | ||
855 | ERROR4: | ||
856 | sysfs_remove_group(&new_client->dev.kobj, &asb100_group); | ||
845 | ERROR3: | 857 | ERROR3: |
846 | i2c_detach_client(data->lm75[1]); | 858 | i2c_detach_client(data->lm75[1]); |
847 | i2c_detach_client(data->lm75[0]); | 859 | i2c_detach_client(data->lm75[0]); |
@@ -861,8 +873,10 @@ static int asb100_detach_client(struct i2c_client *client) | |||
861 | int err; | 873 | int err; |
862 | 874 | ||
863 | /* main client */ | 875 | /* main client */ |
864 | if (data) | 876 | if (data) { |
865 | hwmon_device_unregister(data->class_dev); | 877 | hwmon_device_unregister(data->class_dev); |
878 | sysfs_remove_group(&client->dev.kobj, &asb100_group); | ||
879 | } | ||
866 | 880 | ||
867 | if ((err = i2c_detach_client(client))) | 881 | if ((err = i2c_detach_client(client))) |
868 | return err; | 882 | return err; |