From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932995AbeAKUx6 (ORCPT + 1 other); Thu, 11 Jan 2018 15:53:58 -0500 Received: from smtprelay0064.hostedemail.com ([216.40.44.64]:33128 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932377AbeAKUx5 (ORCPT ); Thu, 11 Jan 2018 15:53:57 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: spark17_5305fab16e3a X-Filterd-Recvd-Size: 1566 Message-ID: <1515704034.9619.165.camel@perches.com> Subject: checkpatch: exclude drivers/staging from if with unnecessary parentheses test From: Joe Perches To: Andrew Morton Cc: LKML , Greg KH Date: Thu, 11 Jan 2018 12:53:54 -0800 Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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. Signed-off-by: Joe Perches --- scripts/checkpatch.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);