From bf76c9308f5f170d3b3795b5fefd858487d7a441 Mon Sep 17 00:00:00 2001 From: vicLin8712 Date: Wed, 26 Nov 2025 10:49:30 +0800 Subject: [PATCH] Refine current-task check in mo_task_suspend() The previous implementation compared `kcb->task_current` against the task's list node. This is always equivalent to comparing the task's TCB in the current implementation, so no functional behavior is affected and the mismatch can never occur. This change simply makes the intended semantics explicit by comparing against the TCB directly, improving readability and clarifying the abstraction. --- kernel/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/task.c b/kernel/task.c index 7365873a..1304a1ee 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -883,7 +883,7 @@ int32_t mo_task_suspend(uint16_t id) } task->state = TASK_SUSPENDED; - bool is_current = (kcb->task_current == node); + bool is_current = (kcb->task_current->data == task); CRITICAL_LEAVE();