All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: utils/serial: Fix semihosting compile error using LLVM
@ 2022-11-08  3:25 Anup Patel
  2022-11-08  9:02 ` Andreas Schwab
  2022-11-08  9:36 ` Xiang W
  0 siblings, 2 replies; 6+ messages in thread
From: Anup Patel @ 2022-11-08  3:25 UTC (permalink / raw)
  To: opensbi

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>
---
 lib/utils/serial/semihosting.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
index 5012fa1..72bbbb3 100644
--- a/lib/utils/serial/semihosting.c
+++ b/lib/utils/serial/semihosting.c
@@ -155,7 +155,7 @@ static int semihosting_getc(void)
 
 	if (semihosting_infd < 0)  {
 		ch = semihosting_trap(SYSREADC, NULL);
-		ret = ch > -1 ? ch : -1;
+		ret = ((int)ch > -1) ? ch : -1;
 	} else
 		ret = semihosting_read(semihosting_infd, &ch, 1) > 0 ? ch : -1;
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-08 12:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08  3:25 [PATCH] lib: utils/serial: Fix semihosting compile error using LLVM Anup Patel
2022-11-08  9:02 ` Andreas Schwab
2022-11-08  9:46   ` Xiang W
2022-11-08 12:06     ` Anup Patel
2022-11-08 12:05   ` Anup Patel
2022-11-08  9:36 ` Xiang W

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.