From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH] lib: utils/serial: Fix semihosting compile error using LLVM
Date: Tue, 8 Nov 2022 08:55:09 +0530 [thread overview]
Message-ID: <20221108032509.1382464-1-apatel@ventanamicro.com> (raw)
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
next reply other threads:[~2022-11-08 3:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 3:25 Anup Patel [this message]
2022-11-08 9:02 ` [PATCH] lib: utils/serial: Fix semihosting compile error using LLVM 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
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=20221108032509.1382464-1-apatel@ventanamicro.com \
--to=apatel@ventanamicro.com \
--cc=opensbi@lists.infradead.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