]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI: EC: Avoid returning AE_OK on errors in address space handler
authorArmin Wolf <W_Armin@gmx.de>
Wed, 22 May 2024 21:36:49 +0000 (23:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Jul 2024 08:38:29 +0000 (10:38 +0200)
[ Upstream commit c4bd7f1d78340e63de4d073fd3dbe5391e2996e5 ]

If an error code other than EINVAL, ENODEV or ETIME is returned
by acpi_ec_read() / acpi_ec_write(), then AE_OK is incorrectly
returned by acpi_ec_space_handler().

Fix this by only returning AE_OK on success, and return AE_ERROR
otherwise.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/ec.c

index 43a8941b6743dc96e15cc6cc03e85a9081b3fb9d..142578451e381581b3efbb3547203db48b2dc490 100644 (file)
@@ -1328,8 +1328,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
                return AE_NOT_FOUND;
        case -ETIME:
                return AE_TIME;
-       default:
+       case 0:
                return AE_OK;
+       default:
+               return AE_ERROR;
        }
 }