summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2023-04-17 09:48:13 +0530
committerAnup Patel <anup@brainfault.org>2023-04-17 09:48:13 +0530
commitf5dfd991396891d87d7780be45f887bc9ed13099 (patch)
treed36d0b0a0b59a27aaa9f9a6da03254bdf474d80e
parent674e0199b23effebfc5311d09b636ca9b46cde7e (diff)
downloadopensbi-f5dfd991396891d87d7780be45f887bc9ed13099.tar.gz
opensbi-f5dfd991396891d87d7780be45f887bc9ed13099.zip
lib: sbi: Don't check SBI error range for legacy console getchar
The legacy console getchar SBI call returns character value in the sbiret.error field so the "SBI_SUCCESS < ret" check in sbi_ecall_handler() results in unwanted error prints for the legacy console getchar SBI call. Let's suppress these unwanted error prints. Fixes: 67b2a408924b ("lib: sbi: sbi_ecall: Check the range of SBI error") Signed-off-by: Anup Patel <apatel@ventanamicro.com>
-rw-r--r--lib/sbi/sbi_ecall.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sbi/sbi_ecall.c b/lib/sbi/sbi_ecall.c
index d0f01665..76a1ae9a 100644
--- a/lib/sbi/sbi_ecall.c
+++ b/lib/sbi/sbi_ecall.c
@@ -120,7 +120,9 @@ int sbi_ecall_handler(struct sbi_trap_regs *regs)
trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap);
} else {
- if (ret < SBI_LAST_ERR || SBI_SUCCESS < ret) {
+ if (ret < SBI_LAST_ERR ||
+ (extension_id != SBI_EXT_0_1_CONSOLE_GETCHAR &&
+ SBI_SUCCESS < ret)) {
sbi_printf("%s: Invalid error %d for ext=0x%lx "
"func=0x%lx\n", __func__, ret,
extension_id, func_id);