diff options
author | Frans Klaver <fransklaver@gmail.com> | 2014-09-21 02:22:17 +0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-09-23 01:17:54 +0400 |
commit | 557b4549714536b161522960a36f0aa7f527418c (patch) | |
tree | f7d422c9c140ead9fa75746dbd3f19ae3c92e669 /drivers/platform | |
parent | d48690383febbf17d958e909ff8f0d15f4497325 (diff) | |
download | linux-557b4549714536b161522960a36f0aa7f527418c.tar.xz |
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, status = acpi_get_handle(NULL, node, &handle); - if (ACPI_SUCCESS(status)) { - status = acpi_install_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - eeepc_rfkill_notify, - eeepc); - if (ACPI_FAILURE(status)) - pr_warn("Failed to register notify on %s\n", node); - - /* - * Refresh pci hotplug in case the rfkill state was - * changed during setup. - */ - eeepc_rfkill_hotplug(eeepc, handle); - } else { + if (ACPI_FAILURE(status)) return -ENODEV; - } + status = acpi_install_notify_handler(handle, + ACPI_SYSTEM_NOTIFY, + eeepc_rfkill_notify, + eeepc); + if (ACPI_FAILURE(status)) + pr_warn("Failed to register notify on %s\n", node); + + /* + * Refresh pci hotplug in case the rfkill state was + * changed during setup. + */ + eeepc_rfkill_hotplug(eeepc, handle); return 0; } @@ -696,20 +694,21 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc, status = acpi_get_handle(NULL, node, &handle); - if (ACPI_SUCCESS(status)) { - status = acpi_remove_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - eeepc_rfkill_notify); - if (ACPI_FAILURE(status)) - pr_err("Error removing rfkill notify handler %s\n", - node); - /* - * Refresh pci hotplug in case the rfkill - * state was changed after - * eeepc_unregister_rfkill_notifier() - */ - eeepc_rfkill_hotplug(eeepc, handle); - } + if (ACPI_FAILURE(status)) + return; + + status = acpi_remove_notify_handler(handle, + ACPI_SYSTEM_NOTIFY, + eeepc_rfkill_notify); + if (ACPI_FAILURE(status)) + pr_err("Error removing rfkill notify handler %s\n", + node); + /* + * Refresh pci hotplug in case the rfkill + * state was changed after + * eeepc_unregister_rfkill_notifier() + */ + eeepc_rfkill_hotplug(eeepc, handle); } static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, |