[PATCH 1/4] checkpatches: warn if perror is used
Stephen Hemminger
stephen at networkplumber.org
Sun Dec 28 21:10:50 CET 2025
The function perror is another way to print to stderr, which
should be discouraged in drivers and libraries.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
devtools/checkpatches.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 9a8199659f..1c6099ac82 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -73,7 +73,7 @@ check_forbidden_additions() { # <patch>
# no output on stdout or stderr
awk -v FOLDERS="lib drivers" \
- -v EXPRESSIONS="\\\<printf\\\> \\\<fprintf\\\(stdout, \\\<fprintf\\\(stderr," \
+ -v EXPRESSIONS="perror\\\( \\\<printf\\\> \\\<fprintf\\\(stdout, \\\<fprintf\\\(stderr," \
-v RET_ON_FAIL=1 \
-v MESSAGE='Writing to stdout or stderr' \
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
--
2.51.0
More information about the dev
mailing list