[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251219092902.51495-1-zhanxusheng@xiaomi.com>
Date: Fri, 19 Dec 2025 17:29:02 +0800
From: Zhan Xusheng <zhanxusheng1024@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>,
linux-sched@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zhan Xusheng <zhanxusheng@...omi.com>
Subject: [PATCH] sched/core: avoid assignment in conditional expression
Split the assignment from the conditional expression when matching
task state. This improves readability and avoids the use of assignment
within an if condition, which is discouraged by the kernel coding style.
No functional change intended.
Signed-off-by: Zhan Xusheng <zhanxusheng@...omi.com>
---
kernel/sched/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 41ba0be16911..c7fb7cbec2e1 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2275,7 +2275,8 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state
running = task_on_cpu(rq, p);
queued = task_on_rq_queued(p);
ncsw = 0;
- if ((match = __task_state_match(p, match_state))) {
+ match = __task_state_match(p, match_state);
+ if (match) {
/*
* When matching on p->saved_state, consider this task
* still queued so it will wait.
--
2.43.0
Powered by blists - more mailing lists