checkpatch: exclude drivers/staging from if with unnecessary parentheses test
authorJoe Perches <[email protected]>
Tue, 6 Feb 2018 23:39:03 +0000 (15:39 -0800)
committerLinus Torvalds <[email protected]>
Wed, 7 Feb 2018 02:32:45 +0000 (18:32 -0800)
Greg KH doesn't like this test so exclude the staging directory from the
implied --strict only test unless --strict is actually used on the
command-line.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Joe Perches <[email protected]>
Cc: Greg KH <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
scripts/checkpatch.pl

index d2464058ab5d7222b1d097ed2263a4ccf9a16f85..3a7499de2c2d8f0d7923f7f2649d37d292af9cc9 100755 (executable)
@@ -4526,7 +4526,9 @@ sub process {
                }
 
 # check for unnecessary parentheses around comparisons in if uses
-               if ($^V && $^V ge 5.10.0 && defined($stat) &&
+# when !drivers/staging or command-line uses --strict
+               if (($realfile !~ m@^(?:drivers/staging/)@ || $check_orig) &&
+                   $^V && $^V ge 5.10.0 && defined($stat) &&
                    $stat =~ /(^.\s*if\s*($balanced_parens))/) {
                        my $if_stat = $1;
                        my $test = substr($2, 1, -1);