aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-08-28 14:43:25 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-26 20:43:53 -0400
commit660a0e8fdf85f30b1e5f6905a78361476094eb7c (patch)
treebbbb3adc62184869713dac5151d5a634ef1160af /drivers
parente1b95dc6b1cd02c3625ba3d1d770d095d6a4b313 (diff)
PCI Hotplug: fix __must_check warnings
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/hotplug/pci_hotplug.h4
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c157
2 files changed, 128 insertions, 33 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug.h b/drivers/pci/hotplug/pci_hotplug.h
index e929b7c11429..772523dc3860 100644
--- a/drivers/pci/hotplug/pci_hotplug.h
+++ b/drivers/pci/hotplug/pci_hotplug.h
@@ -172,8 +172,8 @@ struct hotplug_slot {
172 172
173extern int pci_hp_register (struct hotplug_slot *slot); 173extern int pci_hp_register (struct hotplug_slot *slot);
174extern int pci_hp_deregister (struct hotplug_slot *slot); 174extern int pci_hp_deregister (struct hotplug_slot *slot);
175extern int pci_hp_change_slot_info (struct hotplug_slot *slot, 175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
176 struct hotplug_slot_info *info); 176 struct hotplug_slot_info *info);
177extern struct subsystem pci_hotplug_slots_subsys; 177extern struct subsystem pci_hotplug_slots_subsys;
178 178
179/* PCI Setting Record (Type 0) */ 179/* PCI Setting Record (Type 0) */
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index b7b378df89e3..e2823ea9c4ed 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -482,31 +482,95 @@ static int has_test_file (struct hotplug_slot *slot)
482 482
483static int fs_add_slot (struct hotplug_slot *slot) 483static int fs_add_slot (struct hotplug_slot *slot)
484{ 484{
485 if (has_power_file(slot) == 0) 485 int retval = 0;
486 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_power.attr);
487 486
488 if (has_attention_file(slot) == 0) 487 if (has_power_file(slot) == 0) {
489 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_attention.attr); 488 retval = sysfs_create_file(&slot->kobj, &hotplug_slot_attr_power.attr);
489 if (retval)
490 goto exit_power;
491 }
490 492
491 if (has_latch_file(slot) == 0) 493 if (has_attention_file(slot) == 0) {
492 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_latch.attr); 494 retval = sysfs_create_file(&slot->kobj,
495 &hotplug_slot_attr_attention.attr);
496 if (retval)
497 goto exit_attention;
498 }
493 499
494 if (has_adapter_file(slot) == 0) 500 if (has_latch_file(slot) == 0) {
495 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_presence.attr); 501 retval = sysfs_create_file(&slot->kobj,
502 &hotplug_slot_attr_latch.attr);
503 if (retval)
504 goto exit_latch;
505 }
496 506
497 if (has_address_file(slot) == 0) 507 if (has_adapter_file(slot) == 0) {
498 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_address.attr); 508 retval = sysfs_create_file(&slot->kobj,
509 &hotplug_slot_attr_presence.attr);
510 if (retval)
511 goto exit_adapter;
512 }
499 513
500 if (has_max_bus_speed_file(slot) == 0) 514 if (has_address_file(slot) == 0) {
501 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_max_bus_speed.attr); 515 retval = sysfs_create_file(&slot->kobj,
516 &hotplug_slot_attr_address.attr);
517 if (retval)
518 goto exit_address;
519 }
502 520
521 if (has_max_bus_speed_file(slot) == 0) {
522 retval = sysfs_create_file(&slot->kobj,
523 &hotplug_slot_attr_max_bus_speed.attr);
524 if (retval)
525 goto exit_max_speed;
526 }
527
528 if (has_cur_bus_speed_file(slot) == 0) {
529 retval = sysfs_create_file(&slot->kobj,
530 &hotplug_slot_attr_cur_bus_speed.attr);
531 if (retval)
532 goto exit_cur_speed;
533 }
534
535 if (has_test_file(slot) == 0) {
536 retval = sysfs_create_file(&slot->kobj,
537 &hotplug_slot_attr_test.attr);
538 if (retval)
539 goto exit_test;
540 }
541
542 goto exit;
543
544exit_test:
503 if (has_cur_bus_speed_file(slot) == 0) 545 if (has_cur_bus_speed_file(slot) == 0)
504 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_cur_bus_speed.attr); 546 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_cur_bus_speed.attr);
505 547
506 if (has_test_file(slot) == 0) 548exit_cur_speed:
507 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_test.attr); 549 if (has_max_bus_speed_file(slot) == 0)
550 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_max_bus_speed.attr);
508 551
509 return 0; 552exit_max_speed:
553 if (has_address_file(slot) == 0)
554 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_address.attr);
555
556exit_address:
557 if (has_adapter_file(slot) == 0)
558 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_presence.attr);
559
560exit_adapter:
561 if (has_latch_file(slot) == 0)
562 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr);
563
564exit_latch:
565 if (has_attention_file(slot) == 0)
566 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_attention.attr);
567
568exit_attention:
569 if (has_power_file(slot) == 0)
570 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr);
571exit_power:
572exit:
573 return retval;
510} 574}
511 575
512static void fs_remove_slot (struct hotplug_slot *slot) 576static void fs_remove_slot (struct hotplug_slot *slot)
@@ -626,8 +690,11 @@ int pci_hp_deregister (struct hotplug_slot *slot)
626 * 690 *
627 * Returns 0 if successful, anything else for an error. 691 * Returns 0 if successful, anything else for an error.
628 */ 692 */
629int pci_hp_change_slot_info (struct hotplug_slot *slot, struct hotplug_slot_info *info) 693int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot,
694 struct hotplug_slot_info *info)
630{ 695{
696 int retval;
697
631 if ((slot == NULL) || (info == NULL)) 698 if ((slot == NULL) || (info == NULL))
632 return -ENODEV; 699 return -ENODEV;
633 700
@@ -636,32 +703,60 @@ int pci_hp_change_slot_info (struct hotplug_slot *slot, struct hotplug_slot_info
636 * for the files referring to the fields that have now changed. 703 * for the files referring to the fields that have now changed.
637 */ 704 */
638 if ((has_power_file(slot) == 0) && 705 if ((has_power_file(slot) == 0) &&
639 (slot->info->power_status != info->power_status)) 706 (slot->info->power_status != info->power_status)) {
640 sysfs_update_file(&slot->kobj, &hotplug_slot_attr_power.attr); 707 retval = sysfs_update_file(&slot->kobj,
708 &hotplug_slot_attr_power.attr);
709 if (retval)
710 return retval;
711 }
641 712
642 if ((has_attention_file(slot) == 0) && 713 if ((has_attention_file(slot) == 0) &&
643 (slot->info->attention_status != info->attention_status)) 714 (slot->info->attention_status != info->attention_status)) {
644 sysfs_update_file(&slot->kobj, &hotplug_slot_attr_attention.attr); 715 retval = sysfs_update_file(&slot->kobj,
716 &hotplug_slot_attr_attention.attr);
717 if (retval)
718 return retval;
719 }
645 720
646 if ((has_latch_file(slot) == 0) && 721 if ((has_latch_file(slot) == 0) &&
647 (slot->info->latch_status != info->latch_status)) 722 (slot->info->latch_status != info->latch_status)) {
648 sysfs_update_file(&slot->kobj, &hotplug_slot_attr_latch.attr); 723 retval = sysfs_update_file(&slot->kobj,
724 &hotplug_slot_attr_latch.attr);
725 if (retval)
726 return retval;
727 }
649 728
650 if ((has_adapter_file(slot) == 0) && 729 if ((has_adapter_file(slot) == 0) &&
651 (slot->info->adapter_status != info->adapter_status)) 730 (slot->info->adapter_status != info->adapter_status)) {
652 sysfs_update_file(&slot->kobj, &hotplug_slot_attr_presence.attr); 731 retval = sysfs_update_file(&slot->kobj,
732 &hotplug_slot_attr_presence.attr);
733 if (retval)
734 return retval;
735 }
653 736
654 if ((has_address_file(slot) == 0) && 737 if ((has_address_file(slot) == 0) &&
655 (slot->info->address != info->address)) 738 (slot->info->address != info->address)) {
656 sysfs_update_file(&slot->kobj, &hotplug_slot_attr_address.attr); 739 retval = sysfs_update_file(&slot->kobj,
740 &hotplug_slot_attr_address.attr);
741 if (retval)
742 return retval;
743 }
657 744
658 if ((has_max_bus_speed_file(slot) == 0) && 745 if ((has_max_bus_speed_file(slot) == 0) &&
659 (slot->info->max_bus_speed != info->max_bus_speed)) 746 (slot->info->max_bus_speed != info->max_bus_speed)) {
660 sysfs_update_file(&slot->kobj, &hotplug_slot_attr_max_bus_speed.attr); 747 retval = sysfs_update_file(&slot->kobj,
748 &hotplug_slot_attr_max_bus_speed.attr);
749 if (retval)
750 return retval;
751 }
661 752
662 if ((has_cur_bus_speed_file(slot) == 0) && 753 if ((has_cur_bus_speed_file(slot) == 0) &&
663 (slot->info->cur_bus_speed != info->cur_bus_speed)) 754 (slot->info->cur_bus_speed != info->cur_bus_speed)) {
664 sysfs_update_file(&slot->kobj, &hotplug_slot_attr_cur_bus_speed.attr); 755 retval = sysfs_update_file(&slot->kobj,
756 &hotplug_slot_attr_cur_bus_speed.attr);
757 if (retval)
758 return retval;
759 }
665 760
666 memcpy (slot->info, info, sizeof (struct hotplug_slot_info)); 761 memcpy (slot->info, info, sizeof (struct hotplug_slot_info));
667 762