summaryrefslogtreecommitdiff
path: root/drivers/acpi/power.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-11-04 22:54:17 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-11-05 15:43:47 +0100
commit452a3e723f75880757acf87b053935c43aa89f89 (patch)
treec88f81cb77e637ee3c39c98272158f304b9dd6fd /drivers/acpi/power.c
parentc0d6586afa3546a3d148cf4b9d9a407b4f79d0bb (diff)
ACPI: PM: Fix device wakeup power reference counting error
Fix a device wakeup power reference counting error introduced by commit a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power resources") because of a coding mistake. Fixes: a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power resources") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/power.c')
-rw-r--r--drivers/acpi/power.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 112256154880..5dcb02ededbc 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -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);