Skip to content

Commit 452a3e7

Browse files
committed
ACPI: PM: Fix device wakeup power reference counting error
Fix a device wakeup power reference counting error introduced by commit a2d7b2e ("ACPI: PM: Fix sharing of wakeup power resources") because of a coding mistake. Fixes: a2d7b2e ("ACPI: PM: Fix sharing of wakeup power resources") Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c0d6586 commit 452a3e7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/acpi/power.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -757,13 +757,11 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
757757

758758
mutex_lock(&acpi_device_lock);
759759

760-
if (dev->wakeup.prepare_count > 1) {
761-
dev->wakeup.prepare_count--;
760+
/* Do nothing if wakeup power has not been enabled for this device. */
761+
if (dev->wakeup.prepare_count <= 0)
762762
goto out;
763-
}
764763

765-
/* Do nothing if wakeup power has not been enabled for this device. */
766-
if (!dev->wakeup.prepare_count)
764+
if (--dev->wakeup.prepare_count > 0)
767765
goto out;
768766

769767
err = acpi_device_sleep_wake(dev, 0, 0, 0);

0 commit comments

Comments
 (0)