This is a note to let you know that I've just added the patch titled ACPI: PM: Fix device wakeup power reference counting error to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: acpi-pm-fix-device-wakeup-power-reference-counting-e.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 1d09e3b0062423466cefbca032e6a71462db7a23 Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> Date: Thu Nov 4 22:54:17 2021 +0100 ACPI: PM: Fix device wakeup power reference counting error [ Upstream commit 452a3e723f75880757acf87b053935c43aa89f89 ] 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@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 4b42debeed455..c95eedd58f5bf 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -755,13 +755,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);