Skip to content

Commit 557b454

Browse files
fransklaverdvhart
authored andcommitted
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>
1 parent d486903 commit 557b454

1 file changed

Lines changed: 28 additions & 29 deletions

File tree

‎drivers/platform/x86/eeepc-laptop.c‎

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -668,23 +668,21 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
668668

669669
status = acpi_get_handle(NULL, node, &handle);
670670

671-
if (ACPI_SUCCESS(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 {
671+
if (ACPI_FAILURE(status))
685672
return -ENODEV;
686-
}
687673

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);
688686
return 0;
689687
}
690688

@@ -696,20 +694,21 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc,
696694

697695
status = acpi_get_handle(NULL, node, &handle);
698696

699-
if (ACPI_SUCCESS(status)) {
700-
status = acpi_remove_notify_handler(handle,
701-
ACPI_SYSTEM_NOTIFY,
702-
eeepc_rfkill_notify);
703-
if (ACPI_FAILURE(status))
704-
pr_err("Error removing rfkill notify handler %s\n",
705-
node);
706-
/*
707-
* Refresh pci hotplug in case the rfkill
708-
* state was changed after
709-
* eeepc_unregister_rfkill_notifier()
710-
*/
711-
eeepc_rfkill_hotplug(eeepc, handle);
712-
}
697+
if (ACPI_FAILURE(status))
698+
return;
699+
700+
status = acpi_remove_notify_handler(handle,
701+
ACPI_SYSTEM_NOTIFY,
702+
eeepc_rfkill_notify);
703+
if (ACPI_FAILURE(status))
704+
pr_err("Error removing rfkill notify handler %s\n",
705+
node);
706+
/*
707+
* Refresh pci hotplug in case the rfkill
708+
* state was changed after
709+
* eeepc_unregister_rfkill_notifier()
710+
*/
711+
eeepc_rfkill_hotplug(eeepc, handle);
713712
}
714713

715714
static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,

0 commit comments

Comments
 (0)