From a032aa4c4a54c25f204358248db08a0966d3513c Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 6 Feb 2018 15:39:03 -0800 Subject: checkpatch: exclude drivers/staging from if with unnecessary parentheses test 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/1515704034.9619.165.camel@perches.com Signed-off-by: Joe Perches Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/checkpatch.pl') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d2464058ab5d..3a7499de2c2d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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); -- cgit v1.2.3-59-g8ed1b