aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm78.c
diff options
context:
space:
mode:
authorMark M. Hoffman <mhoffman@lightlink.com>2006-09-24 14:59:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:17 -0400
commitc1685f61b0a3110b701d09b84a9f9a3d4e9ef2e2 (patch)
tree8c7f4791ae7c31390ba127d4e0c0d766775819f4 /drivers/hwmon/lm78.c
parenta1fdcb96ee33ba75318476a2a4691147c9f2ad90 (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/lm78.c')
-rw-r--r--drivers/hwmon/lm78.c88
1 files changed, 51 insertions, 37 deletions
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index fa1715b9a996..ac1b746df6d0 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -482,6 +482,50 @@ static int lm78_isa_attach_adapter(struct i2c_adapter *adapter)
482 return lm78_detect(adapter, isa_address, -1); 482 return lm78_detect(adapter, isa_address, -1);
483} 483}
484 484
485static struct attribute *lm78_attributes[] = {
486 &dev_attr_in0_input.attr,
487 &dev_attr_in0_min.attr,
488 &dev_attr_in0_max.attr,
489 &dev_attr_in1_input.attr,
490 &dev_attr_in1_min.attr,
491 &dev_attr_in1_max.attr,
492 &dev_attr_in2_input.attr,
493 &dev_attr_in2_min.attr,
494 &dev_attr_in2_max.attr,
495 &dev_attr_in3_input.attr,
496 &dev_attr_in3_min.attr,
497 &dev_attr_in3_max.attr,
498 &dev_attr_in4_input.attr,
499 &dev_attr_in4_min.attr,
500 &dev_attr_in4_max.attr,
501 &dev_attr_in5_input.attr,
502 &dev_attr_in5_min.attr,
503 &dev_attr_in5_max.attr,
504 &dev_attr_in6_input.attr,
505 &dev_attr_in6_min.attr,
506 &dev_attr_in6_max.attr,
507 &dev_attr_temp1_input.attr,
508 &dev_attr_temp1_max.attr,
509 &dev_attr_temp1_max_hyst.attr,
510 &dev_attr_fan1_input.attr,
511 &dev_attr_fan1_min.attr,
512 &dev_attr_fan1_div.attr,
513 &dev_attr_fan2_input.attr,
514 &dev_attr_fan2_min.attr,
515 &dev_attr_fan2_div.attr,
516 &dev_attr_fan3_input.attr,
517 &dev_attr_fan3_min.attr,
518 &dev_attr_fan3_div.attr,
519 &dev_attr_alarms.attr,
520 &dev_attr_cpu0_vid.attr,
521
522 NULL
523};
524
525static const struct attribute_group lm78_group = {
526 .attrs = lm78_attributes,
527};
528
485/* This function is called by i2c_probe */ 529/* This function is called by i2c_probe */
486static int lm78_detect(struct i2c_adapter *adapter, int address, int kind) 530static int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
487{ 531{
@@ -616,50 +660,19 @@ static int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
616 } 660 }
617 661
618 /* Register sysfs hooks */ 662 /* Register sysfs hooks */
663 if ((err = sysfs_create_group(&new_client->dev.kobj, &lm78_group)))
664 goto ERROR3;
665
619 data->class_dev = hwmon_device_register(&new_client->dev); 666 data->class_dev = hwmon_device_register(&new_client->dev);
620 if (IS_ERR(data->class_dev)) { 667 if (IS_ERR(data->class_dev)) {
621 err = PTR_ERR(data->class_dev); 668 err = PTR_ERR(data->class_dev);
622 goto ERROR3; 669 goto ERROR4;
623 } 670 }
624 671
625 device_create_file(&new_client->dev, &dev_attr_in0_input);
626 device_create_file(&new_client->dev, &dev_attr_in0_min);
627 device_create_file(&new_client->dev, &dev_attr_in0_max);
628 device_create_file(&new_client->dev, &dev_attr_in1_input);
629 device_create_file(&new_client->dev, &dev_attr_in1_min);
630 device_create_file(&new_client->dev, &dev_attr_in1_max);
631 device_create_file(&new_client->dev, &dev_attr_in2_input);
632 device_create_file(&new_client->dev, &dev_attr_in2_min);
633 device_create_file(&new_client->dev, &dev_attr_in2_max);
634 device_create_file(&new_client->dev, &dev_attr_in3_input);
635 device_create_file(&new_client->dev, &dev_attr_in3_min);
636 device_create_file(&new_client->dev, &dev_attr_in3_max);
637 device_create_file(&new_client->dev, &dev_attr_in4_input);
638 device_create_file(&new_client->dev, &dev_attr_in4_min);
639 device_create_file(&new_client->dev, &dev_attr_in4_max);
640 device_create_file(&new_client->dev, &dev_attr_in5_input);
641 device_create_file(&new_client->dev, &dev_attr_in5_min);
642 device_create_file(&new_client->dev, &dev_attr_in5_max);
643 device_create_file(&new_client->dev, &dev_attr_in6_input);
644 device_create_file(&new_client->dev, &dev_attr_in6_min);
645 device_create_file(&new_client->dev, &dev_attr_in6_max);
646 device_create_file(&new_client->dev, &dev_attr_temp1_input);
647 device_create_file(&new_client->dev, &dev_attr_temp1_max);
648 device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst);
649 device_create_file(&new_client->dev, &dev_attr_fan1_input);
650 device_create_file(&new_client->dev, &dev_attr_fan1_min);
651 device_create_file(&new_client->dev, &dev_attr_fan1_div);
652 device_create_file(&new_client->dev, &dev_attr_fan2_input);
653 device_create_file(&new_client->dev, &dev_attr_fan2_min);
654 device_create_file(&new_client->dev, &dev_attr_fan2_div);
655 device_create_file(&new_client->dev, &dev_attr_fan3_input);
656 device_create_file(&new_client->dev, &dev_attr_fan3_min);
657 device_create_file(&new_client->dev, &dev_attr_fan3_div);
658 device_create_file(&new_client->dev, &dev_attr_alarms);
659 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
660
661 return 0; 672 return 0;
662 673
674ERROR4:
675 sysfs_remove_group(&new_client->dev.kobj, &lm78_group);
663ERROR3: 676ERROR3:
664 i2c_detach_client(new_client); 677 i2c_detach_client(new_client);
665ERROR2: 678ERROR2:
@@ -677,6 +690,7 @@ static int lm78_detach_client(struct i2c_client *client)
677 int err; 690 int err;
678 691
679 hwmon_device_unregister(data->class_dev); 692 hwmon_device_unregister(data->class_dev);
693 sysfs_remove_group(&client->dev.kobj, &lm78_group);
680 694
681 if ((err = i2c_detach_client(client))) 695 if ((err = i2c_detach_client(client)))
682 return err; 696 return err;