Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757942AbcJTIQf (ORCPT ); Thu, 20 Oct 2016 04:16:35 -0400 Received: from smtprelay0114.hostedemail.com ([216.40.44.114]:54464 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757879AbcJTIQb (ORCPT ); Thu, 20 Oct 2016 04:16:31 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1381:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3167:3352:3622:3653:3865:3871:3874:4321:5007:6119:7903:10004:10400:10848:11232:11658:11914:12043:12555:12740:12760:12986:13069:13311:13357:13439:14181:14659:14721:21080:21212:21221:21451:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: farm14_38a5bdd9b3900 X-Filterd-Recvd-Size: 1813 Message-ID: <1476951388.21931.0.camel@perches.com> Subject: Re: [PATCH] checkpatch: don't match against empty $const_structs From: Joe Perches To: Jerome Forissier , Andy Whitcroft , linux-kernel@vger.kernel.org Date: Thu, 20 Oct 2016 01:16:28 -0700 In-Reply-To: <1476951126-30414-1-git-send-email-jerome.forissier@linaro.org> References: <1476951126-30414-1-git-send-email-jerome.forissier@linaro.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.0-2ubuntu1 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 Content-Length: 982 Lines: 29 On Thu, 2016-10-20 at 10:12 +0200, Jerome Forissier wrote: > When $conststructsfile does not exist or is empty, we may get false > warnings such as: > WARNING: struct should normally be const > > Fix that by not running the string match if $const_structs is empty. Why should $const_structs ever be empty? > Signed-off-by: Jerome Forissier > --- > scripts/checkpatch.pl | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index a8368d1..722a319 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -6010,7 +6010,8 @@ sub process { > } > > # check for various structs that are normally const (ops, kgdb, device_tree) > - if ($line !~ /\bconst\b/ && > + if ($const_structs ne "" && > + $line !~ /\bconst\b/ && > $line =~ /\bstruct\s+($const_structs)\b/) { > WARN("CONST_STRUCT", > "struct $1 should normally be const\n" . >