Skip to contentSkip to conversation

PM: sleep: Fix bit masking operation

PATCH Applied Colin Ian King 2 participants 2 messages Mar 19, 2025 – Mar 22, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM: sleep: Fix bit masking operation

The mask operation link->flags | DL_FLAG_PM_RUNTIME is always true which is incorrect. The mask operation should be using the bit-wise & operator. Fix this.

Fixes bca84a7b93fd ("PM: sleep: Use DPM_FLAG_SMART_SUSPEND conditionally")
---
 drivers/base/power/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/main.c +1 -1
index ad50018b8047..ac2a197c1234 100644
@@ -1836,7 +1836,7 @@ static bool device_prepare_smart_suspend(struct device *dev)
 	idx = device_links_read_lock();
 
 	list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) {
-		if (!(link->flags | DL_FLAG_PM_RUNTIME))
+		if (!(link->flags & DL_FLAG_PM_RUNTIME))
 			continue;
 
 		if (!dev_pm_smart_suspend(link->supplier) &&
Signature · 1 line
2.49.0
maintainer Applied
#1 lore raw
Quoted 16 lines · Colin Ian King

The mask operation link->flags | DL_FLAG_PM_RUNTIME is always true which is incorrect. The mask operation should be using the bit-wise & operator. Fix this.

Fixes bca84a7b93fd ("PM: sleep: Use DPM_FLAG_SMART_SUSPEND conditionally")
---
 drivers/base/power/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/main.c +0 -0
index ad50018b8047..ac2a197c1234 100644

drivers/base/power/main.c static bool device_prepare_smart_suspend(struct device *dev)

Quoted 9 lines
drivers/base/power/main.c +1 -2
@@ -1836,7 +1836,7 @@ static bool device_prepare_smart_suspend(struct device *dev)
        idx = device_links_read_lock();
 
        list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) {
-               if (!(link->flags | DL_FLAG_PM_RUNTIME))
+               if (!(link->flags & DL_FLAG_PM_RUNTIME))
                        continue;
 
                if (!dev_pm_smart_suspend(link->supplier) &&
--

Ouch, thanks for the fix!

Applied.