linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: do not check for "/dev/null" while parsing addition of files
@ 2021-05-05  8:12 Manivannan Sadhasivam
  2021-05-05 17:17 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Manivannan Sadhasivam @ 2021-05-05  8:12 UTC (permalink / raw)
  To: akpm, joe, apw; +Cc: linux-kernel, Manivannan Sadhasivam

"/dev/null" is used to signal created or deleted files in the diff header.
While parsing the addition of files, checkpatch should look for
"+++ b/file" and ignore "+++ /dev/null".

Without this change, checkpatch falsely reports below warning for the
patch that does devicetree YAML conversion:

```
WARNING: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

WARNING: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst
```

There was no includes in the patch but the warning was thrown as the logic
was messed up due to the incorrect entry to "elsif" block.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index df8b23dc1eb0..0c201d387ca9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2694,7 +2694,7 @@ sub process {
 			$realfile =~ s@^([^/]*)/@@ if (!$file);
 			$in_commit_log = 0;
 			$found_file = 1;
-		} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
+		} elsif ($line =~ /^\+\+\+\s+b(\S+)/) {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@ if (!$file);
 			$in_commit_log = 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] checkpatch: do not check for "/dev/null" while parsing addition of files
  2021-05-05  8:12 [PATCH] checkpatch: do not check for "/dev/null" while parsing addition of files Manivannan Sadhasivam
@ 2021-05-05 17:17 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2021-05-05 17:17 UTC (permalink / raw)
  To: Manivannan Sadhasivam, akpm, apw; +Cc: linux-kernel

On Wed, 2021-05-05 at 13:42 +0530, Manivannan Sadhasivam wrote:
> "/dev/null" is used to signal created or deleted files in the diff header.
> While parsing the addition of files, checkpatch should look for
> "+++ b/file" and ignore "+++ /dev/null".

nack.  checkpatch shouldn't care about a/ b/ uses here.

> 
> Without this change, checkpatch falsely reports below warning for the
> patch that does devicetree YAML conversion:

Send me a copy of the source patch that creates this false positive.

> 
> ```
> WARNING: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-05 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05  8:12 [PATCH] checkpatch: do not check for "/dev/null" while parsing addition of files Manivannan Sadhasivam
2021-05-05 17:17 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).