* [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np()
@ 2024-04-24 20:24 Daniel Henrique Barboza
2024-04-24 20:24 ` [PATCH v2 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance Daniel Henrique Barboza
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Daniel Henrique Barboza @ 2024-04-24 20:24 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, alistair.francis, bmeng, liwei1518, zhiwei_liu,
palmer, thuth, alex.bennee, philmd, mjt, ajones,
Daniel Henrique Barboza
Hi,
In this new version a small change suggested by Phil was made in patch
2. No other changes made.
Note: checkpatch.pl is nagging quite a bit about the checkpatch.pl change
this time, claiming that I'm adding a line > 90 chars when in reality the
line has 80 chars:
ERROR: line over 90 characters
#39: FILE: scripts/checkpatch.pl:3082:
+ ERROR("use strerror() instead of strerrorname_np()\n" . $herecurr);
total: 1 errors, 0 warnings, 9 lines checked
I supposed it's counting each TAB as more than one char. Let me know if
I need to care about this error and I'll send a v3.
Changes from v1:
- patch 2:
- move the strerrorname_np() check to the "non-portable libc calls"
section
- v1 link: https://lore.kernel.org/qemu-riscv/20240424094700.453356-1-dbarboza@ventanamicro.com/
Daniel Henrique Barboza (2):
target/riscv/kvm: remove sneaky strerrorname_np() instance
checkpatch.pl: forbid strerrorname_np()
scripts/checkpatch.pl | 3 +++
target/riscv/kvm/kvm-cpu.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
--
2.44.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance
2024-04-24 20:24 [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np() Daniel Henrique Barboza
@ 2024-04-24 20:24 ` Daniel Henrique Barboza
2024-04-29 2:15 ` Alistair Francis
2024-04-24 20:24 ` [PATCH v2 2/2] checkpatch.pl: forbid strerrorname_np() Daniel Henrique Barboza
2024-04-24 20:29 ` [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np() Michael Tokarev
2 siblings, 1 reply; 6+ messages in thread
From: Daniel Henrique Barboza @ 2024-04-24 20:24 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, alistair.francis, bmeng, liwei1518, zhiwei_liu,
palmer, thuth, alex.bennee, philmd, mjt, ajones,
Daniel Henrique Barboza
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>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
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, ®);
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);
exit(EXIT_FAILURE);
}
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] checkpatch.pl: forbid strerrorname_np()
2024-04-24 20:24 [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np() Daniel Henrique Barboza
2024-04-24 20:24 ` [PATCH v2 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance Daniel Henrique Barboza
@ 2024-04-24 20:24 ` Daniel Henrique Barboza
2024-04-29 2:16 ` Alistair Francis
2024-04-24 20:29 ` [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np() Michael Tokarev
2 siblings, 1 reply; 6+ messages in thread
From: Daniel Henrique Barboza @ 2024-04-24 20:24 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, alistair.francis, bmeng, liwei1518, zhiwei_liu,
palmer, thuth, alex.bennee, philmd, mjt, ajones,
Daniel Henrique Barboza
Commit d424db2354 removed an instance of strerrorname_np() because it
was breaking building with musl libc. A recent RISC-V patch ended up
re-introducing it again by accident.
Put this function in the baddies list in checkpatch.pl to avoid this
situation again. This is what it will look like next time:
$ ./scripts/checkpatch.pl 0001-temp-test.patch
ERROR: use strerror() instead of strerrorname_np()
#22: FILE: target/riscv/kvm/kvm-cpu.c:1058:
+ strerrorname_np(errno));
total: 1 errors, 0 warnings, 10 lines checked
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
scripts/checkpatch.pl | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7026895074..f7ffa74858 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3078,6 +3078,9 @@ sub process {
if ($line =~ /\b(g_)?assert\(0\)/) {
ERROR("use g_assert_not_reached() instead of assert(0)\n" . $herecurr);
}
+ if ($line =~ /\bstrerrorname_np\(/) {
+ ERROR("use strerror() instead of strerrorname_np()\n" . $herecurr);
+ }
my $non_exit_glib_asserts = qr{g_assert_cmpstr|
g_assert_cmpint|
g_assert_cmpuint|
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np()
2024-04-24 20:24 [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np() Daniel Henrique Barboza
2024-04-24 20:24 ` [PATCH v2 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance Daniel Henrique Barboza
2024-04-24 20:24 ` [PATCH v2 2/2] checkpatch.pl: forbid strerrorname_np() Daniel Henrique Barboza
@ 2024-04-24 20:29 ` Michael Tokarev
2 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2024-04-24 20:29 UTC (permalink / raw)
To: Daniel Henrique Barboza, qemu-devel
Cc: qemu-riscv, alistair.francis, bmeng, liwei1518, zhiwei_liu,
palmer, thuth, alex.bennee, philmd, ajones
24.04.2024 23:24, Daniel Henrique Barboza wrote:
> Hi,
>
> In this new version a small change suggested by Phil was made in patch
> 2. No other changes made.
Applied to trivial-patches tree.
> Note: checkpatch.pl is nagging quite a bit about the checkpatch.pl change
> this time, claiming that I'm adding a line > 90 chars when in reality the
> line has 80 chars:
>
> ERROR: line over 90 characters
> #39: FILE: scripts/checkpatch.pl:3082:
> + ERROR("use strerror() instead of strerrorname_np()\n" . $herecurr);
>
> total: 1 errors, 0 warnings, 9 lines checked
>
> I supposed it's counting each TAB as more than one char. Let me know if
> I need to care about this error and I'll send a v3.
checkpatch complaining about checkpatch change is nice.
Nope, it is the style used here, all other tests are
like this too, but worse.
/mjt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance
2024-04-24 20:24 ` [PATCH v2 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance Daniel Henrique Barboza
@ 2024-04-29 2:15 ` Alistair Francis
0 siblings, 0 replies; 6+ messages in thread
From: Alistair Francis @ 2024-04-29 2:15 UTC (permalink / raw)
To: Daniel Henrique Barboza
Cc: qemu-devel, qemu-riscv, alistair.francis, bmeng, liwei1518,
zhiwei_liu, palmer, thuth, alex.bennee, philmd, mjt, ajones
On Thu, Apr 25, 2024 at 6:27 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> 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>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> 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, ®);
> 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);
> exit(EXIT_FAILURE);
> }
>
> --
> 2.44.0
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] checkpatch.pl: forbid strerrorname_np()
2024-04-24 20:24 ` [PATCH v2 2/2] checkpatch.pl: forbid strerrorname_np() Daniel Henrique Barboza
@ 2024-04-29 2:16 ` Alistair Francis
0 siblings, 0 replies; 6+ messages in thread
From: Alistair Francis @ 2024-04-29 2:16 UTC (permalink / raw)
To: Daniel Henrique Barboza
Cc: qemu-devel, qemu-riscv, alistair.francis, bmeng, liwei1518,
zhiwei_liu, palmer, thuth, alex.bennee, philmd, mjt, ajones
On Thu, Apr 25, 2024 at 6:26 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> Commit d424db2354 removed an instance of strerrorname_np() because it
> was breaking building with musl libc. A recent RISC-V patch ended up
> re-introducing it again by accident.
>
> Put this function in the baddies list in checkpatch.pl to avoid this
> situation again. This is what it will look like next time:
>
> $ ./scripts/checkpatch.pl 0001-temp-test.patch
> ERROR: use strerror() instead of strerrorname_np()
> #22: FILE: target/riscv/kvm/kvm-cpu.c:1058:
> + strerrorname_np(errno));
>
> total: 1 errors, 0 warnings, 10 lines checked
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> scripts/checkpatch.pl | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 7026895074..f7ffa74858 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3078,6 +3078,9 @@ sub process {
> if ($line =~ /\b(g_)?assert\(0\)/) {
> ERROR("use g_assert_not_reached() instead of assert(0)\n" . $herecurr);
> }
> + if ($line =~ /\bstrerrorname_np\(/) {
> + ERROR("use strerror() instead of strerrorname_np()\n" . $herecurr);
> + }
> my $non_exit_glib_asserts = qr{g_assert_cmpstr|
> g_assert_cmpint|
> g_assert_cmpuint|
> --
> 2.44.0
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-29 2:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 20:24 [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np() Daniel Henrique Barboza
2024-04-24 20:24 ` [PATCH v2 1/2] target/riscv/kvm: remove sneaky strerrorname_np() instance Daniel Henrique Barboza
2024-04-29 2:15 ` Alistair Francis
2024-04-24 20:24 ` [PATCH v2 2/2] checkpatch.pl: forbid strerrorname_np() Daniel Henrique Barboza
2024-04-29 2:16 ` Alistair Francis
2024-04-24 20:29 ` [PATCH v2 0/2] riscv,kvm: remove another strerrorname_np() Michael Tokarev
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).