diff mbox series

[RFC,v1,25/30] platform/x86: wmi: simplify error handling logic

Message ID 20210904175450.156801-26-pobrn@protonmail.com (mailing list archive)
State Accepted, archived
Headers show
Series platform/x86: wmi: minor improvements | expand

Commit Message

Barnabás Pőcze Sept. 4, 2021, 5:56 p.m. UTC
The current code carries out the following ACPI status
mapping:

  AE_NOT_FOUND -> AE_OK
  AE_OK        -> AE_OK
  AE_$X        -> AE_$X

That is, everything is mapped to itself, except AE_NOT_FOUND.
The current code does not do it in the most straighforward way.
Simplify the logic.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
---
 drivers/platform/x86/wmi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--
2.33.0
diff mbox series

Patch

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 5929d9d26801..ea7154160946 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -189,11 +189,10 @@  static acpi_status wmi_method_enable(struct wmi_block *wblock, bool enable)

 	snprintf(method, sizeof(method), "WE%02X", block->notify_id);
 	status = acpi_execute_simple_method(handle, method, enable);
-
-	if (status != AE_OK && status != AE_NOT_FOUND)
-		return status;
-	else
+	if (status == AE_NOT_FOUND)
 		return AE_OK;
+
+	return status;
 }

 /*