Skip to content

Commit

Permalink
ACPI: PM: Fix device wakeup power reference counting error
Browse files Browse the repository at this point in the history
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 <rafael.j.wysocki@intel.com>
  • Loading branch information
Rafael J. Wysocki committed Nov 5, 2021
1 parent c0d6586 commit 452a3e7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/acpi/power.c
Original file line number Diff line number Diff line change
@@ -757,13 +757,11 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)

mutex_lock(&acpi_device_lock);

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

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

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

0 comments on commit 452a3e7

Please sign in to comment.