OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: opensbi@lists.infradead.org
Subject: [PATCH] lib: utils/serial: Fix semihosting compile error using LLVM
Date: Tue, 08 Nov 2022 10:02:05 +0100	[thread overview]
Message-ID: <mvmwn85ddki.fsf@suse.de> (raw)
In-Reply-To: <20221108032509.1382464-1-apatel@ventanamicro.com> (Anup Patel's message of "Tue, 8 Nov 2022 08:55:09 +0530")

On Nov 08 2022, Anup Patel wrote:

> 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);

This is using the wrong variable to record the return value of
semihosting_trap (which is of type long, not char).

> -		ret = ch > -1 ? ch : -1;
> +		ret = ((int)ch > -1) ? ch : -1;

I think this line can be removed, and the return value of
semihosting_trap can be returned directly.

-- 
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


  reply	other threads:[~2022-11-08  9:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  3:25 [PATCH] lib: utils/serial: Fix semihosting compile error using LLVM Anup Patel
2022-11-08  9:02 ` Andreas Schwab [this message]
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=mvmwn85ddki.fsf@suse.de \
    --to=schwab@suse.de \
    --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