[PATCH 3/4] checkpatch: don't stop at the first empty input
From: Bjorn Andersson
Date: Sat Nov 07 2026 - 23:23:07 EST
When checkpatch is given multiple inputs, process() calls exit(0) as
soon as it encounters an empty one. This discards the failure status
of inputs already checked, and the remaining inputs are never checked.
E.g. a patch with a bogus Fixes: tag followed by an empty file reports
the warning, but the run is still reported as successful:
$ ./scripts/checkpatch.pl -q --terse bad.patch empty.patch
bad.patch:9: WARNING: Unknown commit id '6393a36fe184', ...
total: 0 errors, 1 warnings, 7 lines checked
$ echo $?
0
With the order reversed, bad.patch is never checked at all.
The same happens with --file when one of the files doesn't exist, as
the diff against /dev/null then produces no output. A mistyped file
name therefore causes all following files to be silently skipped:
$ ./scripts/checkpatch.pl -q --terse -f missing.c existing.c
diff: missing.c: No such file or directory
$ echo $?
0
Return from process() instead, so the empty input is still silently
skipped while the remaining inputs are checked and the exit status
reflects all of them.
Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 45279c17f70a..a5e6f96477c3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7874,7 +7874,7 @@ sub process {
# If we have no input at all, then there is nothing to report on
# so just keep quiet.
if ($#rawlines == -1) {
- exit(0);
+ return 1;
}
# In mailback mode only produce a report in the negative, for
--
2.55.0