From: Hui Wang <hui.wang@canonical.com>
To: linux-riscv@lists.infradead.org, pjw@kernel.org,
palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
danil.skrebenkov@cloudbear.ru, ajones@ventanamicro.com,
atish.patra@linux.dev
Cc: hui.wang@canonical.com
Subject: [PATCH 2/2] riscv: cpu_ops_sbi: No need to be bothered to check ret.error
Date: Thu, 9 Apr 2026 21:32:47 +0800 [thread overview]
Message-ID: <20260409133247.76215-2-hui.wang@canonical.com> (raw)
In-Reply-To: <20260409133247.76215-1-hui.wang@canonical.com>
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>
---
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-04-09 13:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 13:32 [PATCH 1/2] riscv: cpu_ops: Change return value type of cpu_is_stopped() to bool Hui Wang
2026-04-09 13:32 ` Hui Wang [this message]
2026-04-10 14:36 ` Danil Skrebenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260409133247.76215-2-hui.wang@canonical.com \
--to=hui.wang@canonical.com \
--cc=ajones@ventanamicro.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@linux.dev \
--cc=danil.skrebenkov@cloudbear.ru \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox