mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonas Gorski <jonas.gorski@gmail.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] checkpatch: ignore /dev/null being added for file path checks
Date: Sat, 15 Jul 2023 11:58:04 +0200	[thread overview]
Message-ID: <20230715095804.14258-1-jonas.gorski@gmail.com> (raw)

In e.g. schema to yaml conversion patches, a file may be deleted,
causing checkpatch in strict mode to complain about files outside of the
bindings directory being modified:

  ./scripts/checkpatch.pl --strict --showfile 0001-dt-bindings-spi-convert-spi-brcm63xx.txt-to-YAML.patch
  dev/null:72: WARNING: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst
  total: 0 errors, 1 warnings, 0 checks, 79 lines checked

Since this isn't a real file, skip any further checks based on the
file's location.

Fixes: 133712a2ec84 ("checkpatch: DT bindings should be a separate patch")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 880fde13d9b8..30de47909460 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2856,6 +2856,12 @@ sub process {
 			$realfile =~ s@^([^/]*)/@@ if (!$file);
 			$in_commit_log = 0;
 
+			# "/dev/null" being added means a file was actually
+			# deleted, no need for further file location checks
+			if ($line eq "+++ /dev/null") {
+				next;
+			}
+
 			$p1_prefix = $1;
 			if (!$file && $tree && $p1_prefix ne '' &&
 			    -e "$root/$p1_prefix") {
-- 
2.34.1


             reply	other threads:[~2023-07-15  9:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15  9:58 Jonas Gorski [this message]
2023-07-15 13:53 ` Joe Perches

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=20230715095804.14258-1-jonas.gorski@gmail.com \
    --to=jonas.gorski@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=robh@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®