]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: cpu_ops_sbi: No need to be bothered to check ret.error
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)
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@canonical.com>
Link: https://patch.msgid.link/20260413123515.48423-2-hui.wang@canonical.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/kernel/cpu_ops_sbi.c

index 146ceab1011feef75bdda867d5024add0d3cced6..ee6e4b5cc39e96b3ea683f30b689f7f200f45f27 100644 (file)
@@ -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)