diff options
author | Frans Klaver <fransklaver@gmail.com> | 2014-09-20 18:22:17 -0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-09-22 17:17:54 -0400 |
commit | 557b4549714536b161522960a36f0aa7f527418c (patch) | |
tree | f7d422c9c140ead9fa75746dbd3f19ae3c92e669 /drivers/platform | |
parent | d48690383febbf17d958e909ff8f0d15f4497325 (diff) |
eeepc-laptop: clean up control flow in *_rfkill_notifier
Handle errors immediately in eeepc_register_rfkill_notifier and
eeepc_unregister_rfkill_notifier. This clears up the control flow for the
reader. It also removes unnecessary indentation.
Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 3f6c762fb560..db79902c4a8e 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -668,23 +668,21 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, | |||
668 | 668 | ||
669 | status = acpi_get_handle(NULL, node, &handle); | 669 | status = acpi_get_handle(NULL, node, &handle); |
670 | 670 | ||
671 | if (ACPI_SUCCESS(status)) { | 671 | if (ACPI_FAILURE(status)) |
672 | status = acpi_install_notify_handler(handle, | ||
673 | ACPI_SYSTEM_NOTIFY, | ||
674 | eeepc_rfkill_notify, | ||
675 | eeepc); | ||
676 | if (ACPI_FAILURE(status)) | ||
677 | pr_warn("Failed to register notify on %s\n", node); | ||
678 | |||
679 | /* | ||
680 | * Refresh pci hotplug in case the rfkill state was | ||
681 | * changed during setup. | ||
682 | */ | ||
683 | eeepc_rfkill_hotplug(eeepc, handle); | ||
684 | } else { | ||
685 | return -ENODEV; | 672 | return -ENODEV; |
686 | } | ||
687 | 673 | ||
674 | status = acpi_install_notify_handler(handle, | ||
675 | ACPI_SYSTEM_NOTIFY, | ||
676 | eeepc_rfkill_notify, | ||
677 | eeepc); | ||
678 | if (ACPI_FAILURE(status)) | ||
679 | pr_warn("Failed to register notify on %s\n", node); | ||
680 | |||
681 | /* | ||
682 | * Refresh pci hotplug in case the rfkill state was | ||
683 | * changed during setup. | ||
684 | */ | ||
685 | eeepc_rfkill_hotplug(eeepc, handle); | ||
688 | return 0; | 686 | return 0; |
689 | } | 687 | } |
690 | 688 | ||
@@ -696,20 +694,21 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc, | |||
696 | 694 | ||
697 | status = acpi_get_handle(NULL, node, &handle); | 695 | status = acpi_get_handle(NULL, node, &handle); |
698 | 696 | ||
699 | if (ACPI_SUCCESS(status)) { | 697 | if (ACPI_FAILURE(status)) |
700 | status = acpi_remove_notify_handler(handle, | 698 | return; |
701 | ACPI_SYSTEM_NOTIFY, | 699 | |
702 | eeepc_rfkill_notify); | 700 | status = acpi_remove_notify_handler(handle, |
703 | if (ACPI_FAILURE(status)) | 701 | ACPI_SYSTEM_NOTIFY, |
704 | pr_err("Error removing rfkill notify handler %s\n", | 702 | eeepc_rfkill_notify); |
705 | node); | 703 | if (ACPI_FAILURE(status)) |
706 | /* | 704 | pr_err("Error removing rfkill notify handler %s\n", |
707 | * Refresh pci hotplug in case the rfkill | 705 | node); |
708 | * state was changed after | 706 | /* |
709 | * eeepc_unregister_rfkill_notifier() | 707 | * Refresh pci hotplug in case the rfkill |
710 | */ | 708 | * state was changed after |
711 | eeepc_rfkill_hotplug(eeepc, handle); | 709 | * eeepc_unregister_rfkill_notifier() |
712 | } | 710 | */ |
711 | eeepc_rfkill_hotplug(eeepc, handle); | ||
713 | } | 712 | } |
714 | 713 | ||
715 | static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, | 714 | static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, |