[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 9/9] checkpatch.pl: forbid strerrorname_np()
From: |
Michael Tokarev |
Subject: |
[PULL 9/9] checkpatch.pl: forbid strerrorname_np() |
Date: |
Mon, 29 Apr 2024 09:45:36 +0300 |
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
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>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
scripts/checkpatch.pl | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 76a0b79266..ff373a7083 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.39.2
- [PULL 0/9] Trivial patches for 2024-04-29, Michael Tokarev, 2024/04/29
- [PULL 7/9] target/loongarch/cpu.c: typo fix: expection, Michael Tokarev, 2024/04/29
- [PULL 1/9] target/i386/cpu: Remove "x86" prefix from the CPU list, Michael Tokarev, 2024/04/29
- [PULL 4/9] scripts/checkpatch: Avoid author email mangled by qemu-*@nongnu.org, Michael Tokarev, 2024/04/29
- [PULL 6/9] backends/cryptodev-builtin: Fix local_error leaks, Michael Tokarev, 2024/04/29
- [PULL 2/9] target/s390x/cpu_models: Rework the output of "-cpu help", Michael Tokarev, 2024/04/29
- [PULL 3/9] target/ppc/cpu_init: Remove "PowerPC" prefix from the CPU list, Michael Tokarev, 2024/04/29
- [PULL 9/9] checkpatch.pl: forbid strerrorname_np(),
Michael Tokarev <=
- [PULL 5/9] scripts/checkpatch: Do not use mailmap, Michael Tokarev, 2024/04/29
- [PULL 8/9] target/riscv/kvm: remove sneaky strerrorname_np() instance, Michael Tokarev, 2024/04/29