From: Lv Zheng Date: Mon, 15 Dec 2014 00:47:52 +0000 (+0800) Subject: ACPI / EC: Fix unexpected ec_remove_handlers() invocations X-Git-Tag: firefly_0821_release~176^2~2625^2~2^4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1741acea75ea51ce709304a26baf72e1e99b8f3a;p=firefly-linux-kernel-4.4.55.git ACPI / EC: Fix unexpected ec_remove_handlers() invocations The ec_remove_handlers() is invoked without checking EC_FLAGS_HANDLERS_INSTALLED, this patch enhances this check to avoid issues that acpi_disable_gpe() is invoked unexpectedly to reduce the GPE runtime count. This may happen when the EC handler installation failed on some platforms. Reported-by: Venkat Raghavulu Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5f9b74b9b71f..1b5853f384e2 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -844,6 +844,8 @@ static int ec_install_handlers(struct acpi_ec *ec) static void ec_remove_handlers(struct acpi_ec *ec) { + if (!test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags)) + return; acpi_disable_gpe(NULL, ec->gpe); if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))