diff mbox series

[next] PM: sleep: Fix bit masking operation

Message ID 20250319114324.791829-1-colin.i.king@gmail.com (mailing list archive)
State In Next
Delegated to: Rafael Wysocki
Headers show
Series [next] PM: sleep: Fix bit masking operation | expand

Commit Message

Colin Ian King March 19, 2025, 11:43 a.m. UTC
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")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/base/power/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki March 22, 2025, 2:08 p.m. UTC | #1
On Wed, Mar 19, 2025 at 12:44 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> 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")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/base/power/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index ad50018b8047..ac2a197c1234 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -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.
diff mbox series

Patch

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index ad50018b8047..ac2a197c1234 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -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) &&