ACPI: EC: Fix up fast path check in acpi_ec_add()
diff mbox series

Message ID 1708495.96b3J6AjSg@kreacher
State Accepted
Commit d7e0481c0d0f0d2e73d4f1e675cb89d0308d0f7c
Headers show
  • ACPI: EC: Fix up fast path check in acpi_ec_add()
Related show

Commit Message

Rafael J. Wysocki April 6, 2020, 3:49 p.m. UTC
From: Rafael J. Wysocki <>

The fast path check in acpi_ec_add() is not incorrect, because in
fact acpi_device_hid(device) can be equal to ACPI_ECDT_HID only if
boot_ec is not NULL, but it may confuse static checkers, so change
it to explicitly check boot_ec upfront and use the slow path if
that pointer is NULL.

Fixes: 3d9b8dd8320d ("ACPI: EC: Use fast path in acpi_ec_add() for DSDT boot EC")
Reported-by: Dan Carpenter <>
Signed-off-by: Rafael J. Wysocki <>
 drivers/acpi/ec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff mbox series

Index: linux-pm/drivers/acpi/ec.c
--- linux-pm.orig/drivers/acpi/ec.c
+++ linux-pm/drivers/acpi/ec.c
@@ -1589,8 +1589,8 @@  static int acpi_ec_add(struct acpi_devic
 	strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_EC_CLASS);
-	if ((boot_ec && boot_ec->handle == device->handle) ||
-	    !strcmp(acpi_device_hid(device), ACPI_ECDT_HID)) {
+	if (boot_ec && (boot_ec->handle == device->handle ||
+	    !strcmp(acpi_device_hid(device), ACPI_ECDT_HID))) {
 		/* Fast path: this device corresponds to the boot EC. */
 		ec = boot_ec;
 	} else {