[PATCH] sched: Fix assignment in if condition in wait_task_inactive

From: XueBing Chen

Date: Fri Oct 17 2025 - 02:32:08 EST


Fix checkpatch.pl ERROR: "do not use assignment in if condition"

The code in wait_task_inactive() had an assignment inside an if condition,
which violates the kernel coding style. This patch separates the assignment
from the conditional check for better readability and maintainability.

Signed-off-by: XueBing Chen <chenxb_99091@xxxxxxx>
---
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 198d2dd45..2dae4cd53 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2305,7 +2305,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.17.1