[PATCH 2/2] riscv: cpu_ops_sbi: No need to be bothered to check ret.error
Hui Wang
hui.wang at canonical.com
Thu Apr 9 06:32:47 PDT 2026
If the ret.error equals to 0, the sbi_err_map_linux_errno() can also
handle it, i.e. if ret.error is SBI_SUCCESS, it will return 0
immediately, so no need to be bothered to check ret.error here.
Signed-off-by: Hui Wang <hui.wang at canonical.com>
---
arch/riscv/kernel/cpu_ops_sbi.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/arch/riscv/kernel/cpu_ops_sbi.c b/arch/riscv/kernel/cpu_ops_sbi.c
index a17b7576b77d..07d5752a7b03 100644
--- a/arch/riscv/kernel/cpu_ops_sbi.c
+++ b/arch/riscv/kernel/cpu_ops_sbi.c
@@ -30,10 +30,8 @@ static int sbi_hsm_hart_start(unsigned long hartid, unsigned long saddr,
ret = sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_START,
hartid, saddr, priv, 0, 0, 0);
- if (ret.error)
- return sbi_err_map_linux_errno(ret.error);
- else
- return 0;
+
+ return sbi_err_map_linux_errno(ret.error);
}
#ifdef CONFIG_HOTPLUG_CPU
@@ -43,10 +41,7 @@ static int sbi_hsm_hart_stop(void)
ret = sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_STOP, 0, 0, 0, 0, 0, 0);
- if (ret.error)
- return sbi_err_map_linux_errno(ret.error);
- else
- return 0;
+ return sbi_err_map_linux_errno(ret.error);
}
static int sbi_hsm_hart_get_status(unsigned long hartid)
--
2.43.0
More information about the linux-riscv
mailing list