[PATCH] checkpatch: do not check for "/dev/null" while parsing addition of files
From: Manivannan Sadhasivam
Date: Wed May 05 2021 - 04:12:56 EST
"/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@xxxxxxxxxx>
---
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