]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
riscv: cpu_ops: Change return value type of cpu_is_stopped() to bool
authorHui Wang <hui.wang@canonical.com>
Sun, 7 Jun 2026 02:17:54 +0000 (20:17 -0600)
committerPaul Walmsley <pjw@kernel.org>
Sun, 7 Jun 2026 05:48:14 +0000 (23:48 -0600)
commit2b2b207e1162e577cd6208e184d3d3a0fcfa9cca
tree9fe8ded3725c4f15f6584d81efdc14d1c94a6f7e
parent063e01ded573b62aa90e4a60a73cff9070bb96b9
riscv: cpu_ops: Change return value type of cpu_is_stopped() to bool

In the original sbi_cpu_is_stopped(), if rc doesn't equal to the
SBI_HSM_STATE_STOPPED, it will return rc to the caller directly. But
there is a hidden problem, the rc could be SBI_HSM_STATE_STARTED, if
so, this function will report cpu stopped while the cpu isn't really
stopped.

Furthermore, from the name of cpu_is_stopped(), it gives a sense the
return value is a bool type, true means the cpu is stopped, conversely
false means the cpu is not stopped.

Here change the return value type to bool and change the callers
accordingly. This could fix the above two issues.

Fixes: f1e58583b9c7c ("RISC-V: Support cpu hotplug")
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://patch.msgid.link/20260413123515.48423-1-hui.wang@canonical.com
[pjw@kernel.org: cleaned up some of the pr_warn() messages]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/include/asm/cpu_ops.h
arch/riscv/kernel/cpu-hotplug.c
arch/riscv/kernel/cpu_ops_sbi.c