From a4a538db9fa6e2195e482c0b95a1be87a74201b2 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 2 Aug 2019 19:13:14 -0400 Subject: [PATCH] ACPI: Avoid discarding a potential error value. This is part of a new diagnostic I've managed to wire up that finds all instances of "status_t" function return values being discarded using attribute trickery and some creative Clang pragmas. As you might guess, the resultant errors list is absolutely gigantic, and most of them are ones where the failure condition will never (that we care about) be hit. The ones in this commit likely are no-op changes, but they were low-hanging fruit spotted while reviewing the larger list. The next commit will bring more substantial changes. --- src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp | 7 +++---- src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp b/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp index a65c9166bc..3aad4e020e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/ACPICAHaiku.cpp @@ -772,10 +772,9 @@ AcpiOsRemoveInterruptHandler(UINT32 interruptNumber, DEBUG_FUNCTION_F("vector: %lu; handler: %p", (uint32)interruptNumber, serviceRoutine); #ifdef _KERNEL_MODE - remove_io_interrupt_handler(interruptNumber, - (interrupt_handler) serviceRoutine, - sInterruptHandlerData[interruptNumber]); - return AE_OK; + return remove_io_interrupt_handler(interruptNumber, + (interrupt_handler)serviceRoutine, + sInterruptHandlerData[interruptNumber]) == B_OK ? AE_OK : AE_ERROR; #else return AE_ERROR; #endif diff --git a/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h b/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h index d0149d9c30..d4c71814ab 100644 --- a/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h +++ b/src/add-ons/kernel/bus_managers/acpi/EmbeddedController.h @@ -188,15 +188,13 @@ static status_t EcLock(struct acpi_ec_cookie *sc) { /* If _GLK is non-zero, acquire the global lock. */ - status_t status = B_OK; if (sc->ec_glk) { - status = sc->ec_acpi_module->acquire_global_lock(EC_LOCK_TIMEOUT, + status_t status = sc->ec_acpi_module->acquire_global_lock(EC_LOCK_TIMEOUT, &sc->ec_glkhandle); if (status != B_OK) return status; } - mutex_lock(&sc->ec_lock); - return status; + return mutex_lock(&sc->ec_lock); }