From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM
Date: Tue, 8 Nov 2022 17:40:16 +0530 [thread overview]
Message-ID: <20221108121016.1441356-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 | 4 ++--
1 file 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;
--
2.34.1
next reply other threads:[~2022-11-08 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 12:10 Anup Patel [this message]
2022-11-09 15:07 ` [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM Xiang W
2022-11-14 16:09 ` Bin Meng
2022-11-15 11:16 ` Anup Patel
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=20221108121016.1441356-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