[PATCH] ACPI: PM: Fix device wakeup power reference counting error

From: Rafael J. Wysocki
Date: Thu Nov 04 2021 - 13:24:06 EST


From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

Fix a device wakeup power reference counting error introduced by
commit a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power
resources").

Fixes: a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power resources")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/power.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -757,10 +757,8 @@ int acpi_disable_wakeup_device_power(str

mutex_lock(&acpi_device_lock);

- if (dev->wakeup.prepare_count > 1) {
+ if (dev->wakeup.prepare_count >= 1)
dev->wakeup.prepare_count--;
- goto out;
- }

/* Do nothing if wakeup power has not been enabled for this device. */
if (!dev->wakeup.prepare_count)