mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
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: 7f09fba86e
("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>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user