aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2022-11-08 17:40:16 +0530
committerAnup Patel <anup@brainfault.org>2022-11-15 16:38:41 +0530
commit7b29264f11b8ac9aef0df23122feed763f803779 (patch)
tree0fb2d484c09a34a1ef4023149d31ded606520627 /lib
parent8e9966c1a722b4b630bb1f5f3cf6a1f8a4726102 (diff)
downloadopensbi-7b29264f11b8ac9aef0df23122feed763f803779.zip
opensbi-7b29264f11b8ac9aef0df23122feed763f803779.tar.gz
opensbi-7b29264f11b8ac9aef0df23122feed763f803779.tar.bz2
lib: utils/serial: Fix semihosting compile error using LLVM
We fix the following semihosting compile error observed using LLVM: lib/utils/serial/semihosting.c:158:12: error: result of comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare] ret = ch > -1 ? ch : -1; ~~ ^ ~~ Fixes: 7f09fba86e43 ("lib: utils/serial: add semihosting support") Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Bin Meng <bmeng@tinylab.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/serial/semihosting.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
index 5012fa1..86fa296 100644
--- a/lib/utils/serial/semihosting.c
+++ b/lib/utils/serial/semihosting.c
@@ -154,8 +154,8 @@ static int semihosting_getc(void)
int ret;
if (semihosting_infd < 0) {
- ch = semihosting_trap(SYSREADC, NULL);
- ret = ch > -1 ? ch : -1;
+ ret = semihosting_trap(SYSREADC, NULL);
+ ret = ret < 0 ? -1 : ret;
} else
ret = semihosting_read(semihosting_infd, &ch, 1) > 0 ? ch : -1;