qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
	qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com,
	bmeng@tinylab.org, liwei1518@gmail.com,
	zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com,
	thuth@redhat.com, alex.bennee@linaro.org, mjt@tls.msk.ru,
	ajones@ventanamicro.com
Subject: Re: [PATCH 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance
Date: Wed, 24 Apr 2024 19:54:22 +0200	[thread overview]
Message-ID: <409f547e-fdab-4183-8f9a-9852f9be34f6@linaro.org> (raw)
In-Reply-To: <a619f516-d174-428a-aa19-52664282265b@ventanamicro.com>

On 24/4/24 19:18, Daniel Henrique Barboza wrote:
> On 4/24/24 06:55, Philippe Mathieu-Daudé wrote:
>> On 24/4/24 11:46, Daniel Henrique Barboza wrote:
>>> Commit d424db2354 excluded some strerrorname_np() instances because they
>>> break musl libc builds. Another instance happened to slip by via commit
>>> d4ff3da8f4.
>>>
>>> Remove it before it causes trouble again.
>>>
>>> Fixes: d4ff3da8f4 (target/riscv/kvm: initialize 'vlenb' via 
>>> get-reg-list)
>>> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
>>> ---
>>>   target/riscv/kvm/kvm-cpu.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
>>> index 6a6c6cae80..ee69ea9785 100644
>>> --- a/target/riscv/kvm/kvm-cpu.c
>>> +++ b/target/riscv/kvm/kvm-cpu.c
>>> @@ -1054,8 +1054,8 @@ static void kvm_riscv_read_vlenb(RISCVCPU *cpu, 
>>> KVMScratchCPU *kvmcpu,
>>>           ret = ioctl(kvmcpu->cpufd, KVM_GET_ONE_REG, &reg);
>>>           if (ret != 0) {
>>> -            error_report("Unable to read vlenb register, error code: 
>>> %s",
>>> -                         strerrorname_np(errno));
>>> +            error_report("Unable to read vlenb register, error code: 
>>> %d",
>>> +                         errno);
>>
>> Why not use "%s" strerror(errno)?
> 
> It's not exactly the same. For errno = 2 strerrorname_np() gives 
> "ENOENT", and
> sterror() gives "No such file or directory". In this particular context 
> I think
> just printing a "error code -2" is clearer because we're not mentioning 
> files and
> dirs in a KVM reg context.
> 
> But in the end I don't mind changing to strerror() if you feel strong 
> about it. It's
> fine either way.

I'm fine with "error code -2" ;)

Regards,

Phil.


  reply	other threads:[~2024-04-24 17:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  9:46 [PATCH 0/2] riscv,kvm: remove another strerrorname_np() Daniel Henrique Barboza
2024-04-24  9:46 ` [PATCH 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance Daniel Henrique Barboza
2024-04-24  9:51   ` Thomas Huth
2024-04-24  9:55   ` Philippe Mathieu-Daudé
2024-04-24 17:18     ` Daniel Henrique Barboza
2024-04-24 17:54       ` Philippe Mathieu-Daudé [this message]
2024-04-24  9:47 ` [PATCH 2/2] checkpatch.pl: forbid strerrorname_np() Daniel Henrique Barboza
2024-04-24  9:52   ` Thomas Huth
2024-04-24  9:57   ` Philippe Mathieu-Daudé
2024-04-24  9:58 ` [PATCH 0/2] riscv,kvm: remove another strerrorname_np() Philippe Mathieu-Daudé

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=409f547e-fdab-4183-8f9a-9852f9be34f6@linaro.org \
    --to=philmd@linaro.org \
    --cc=ajones@ventanamicro.com \
    --cc=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=bmeng@tinylab.org \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=mjt@tls.msk.ru \
    --cc=palmer@rivosinc.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /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;
as well as URLs for NNTP newsgroup(s).