]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
platform/x86: wmi: simplify error handling logic
authorBarnabás Pőcze <pobrn@protonmail.com>
Sat, 4 Sep 2021 17:56:29 +0000 (17:56 +0000)
committerHans de Goede <hdegoede@redhat.com>
Tue, 14 Sep 2021 10:26:02 +0000 (12:26 +0200)
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>
Link: https://lore.kernel.org/r/20210904175450.156801-26-pobrn@protonmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/wmi.c

index f4f68b31eb6a4d22861390d759d775866aeff0d4..7753836571feb62ff078c20c91c7b3ae624c105b 100644 (file)
@@ -189,11 +189,10 @@ static acpi_status wmi_method_enable(struct wmi_block *wblock, bool enable)
 
        snprintf(method, 5, "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;
 }
 
 /*