mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Subject: [PATCH 2/4] checkpatch: don't stop at the first non-patch input with --no-patch
Date: Sun, 08 Nov 2026 04:21:03 +0000	[thread overview]
Message-ID: <20261108-checkpatch-fixes-hash-v1-2-d49b3085c20b@oss.qualcomm.com> (raw)
In-Reply-To: <20261108-checkpatch-fixes-hash-v1-0-d49b3085c20b@oss.qualcomm.com>

When checkpatch is given multiple inputs with --no-patch, process()
calls exit(0) as soon as it encounters an input that isn't a patch.
The remaining inputs are never checked, and the run is reported as
successful even if later inputs contain errors or warnings.

E.g. with a non-patch file followed by a patch with a bogus Fixes: tag:

  $ ./scripts/checkpatch.pl -q --terse --no-patch notes.txt bad.patch
  $ echo $?
  0

Return from process() instead, so the non-patch input is still
silently skipped while the remaining inputs are checked.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e84bb4c12eb4..45279c17f70a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7886,7 +7886,7 @@ sub process {
 	# This is not a patch, and we are in 'no-patch' mode so
 	# just keep quiet.
 	if (!$chk_patch && !$is_patch) {
-		exit(0);
+		return 1;
 	}
 
 	if (!$is_patch && $filename !~ /cover-letter\.patch$/) {

-- 
2.55.0


  parent reply	other threads:[~2026-11-08  4:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08  4:21 [PATCH 0/4] checkpatch: improve exit criterias Bjorn Andersson
2026-11-08  4:21 ` [PATCH 1/4] checkpatch: don't stop at the first clean patch with --mailback Bjorn Andersson
2026-11-08  4:21 ` Bjorn Andersson [this message]
2026-11-08  4:21 ` [PATCH 3/4] checkpatch: don't stop at the first empty input Bjorn Andersson
2026-11-08  4:21 ` [PATCH 4/4] checkpatch: fail on missing or unreadable files with --file Bjorn Andersson

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=20261108-checkpatch-fixes-hash-v1-2-d49b3085c20b@oss.qualcomm.com \
    --to=bjorn.andersson@oss.qualcomm.com \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®