From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752860AbcFCQQ1 (ORCPT ); Fri, 3 Jun 2016 12:16:27 -0400 Received: from smtprelay0030.hostedemail.com ([216.40.44.30]:40013 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752695AbcFCQQ0 (ORCPT ); Fri, 3 Jun 2016 12:16:26 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:560:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:7903:10004:10400:10848:11232:11658:11914:12517:12519:12740:13069:13311:13357:13439:14659:21080:21324:30012:30034:30054:30064: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: gold26_54e764ebbf853 X-Filterd-Recvd-Size: 1857 Message-ID: <1464970582.11800.13.camel@perches.com> Subject: Re: [PATCH] checkpatch: Flag code that returns a negative number From: Joe Perches To: Nishanth Menon , "Andrew F. Davis" , Andy Whitcroft Cc: linux-kernel@vger.kernel.org, Andrew Morton Date: Fri, 03 Jun 2016 09:16:22 -0700 In-Reply-To: <5751AB4A.7040805@ti.com> References: <1464967533-14634-1-git-send-email-nm@ti.com> <1464968493.11800.3.camel@perches.com> <5751A6F7.1030305@ti.com> <1464969664.11800.9.camel@perches.com> <5751AB4A.7040805@ti.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 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 On Fri, 2016-06-03 at 11:07 -0500, Nishanth Menon wrote: > On 06/03/2016 11:01 AM, Joe Perches wrote: > > [...] > > > > I did more or less the same grep, and that's somewhat true. > > -1 though is very common and doesn't need to be replaced. > OK, > > > > > > > $ git grep -E "\breturn\s+\-\s*[0-9]+\s*;" * | grep -v "^tools" | > > grep -vP "return\s*\-1;" | wc -l > > 211 > > > > Looking at some of the specific instances of negative return values > > instead of the line counts though may show otherwise. > > > > -EFOO errors aren't always better. > At least would'nt be a little more readable than obscure -val? > > Would we like -[2-9][0-9]* flagged at all even as a check? I think not, but you should look at the other !-1 instances and see what you think. But if it does, it should probably use '-\s*{?!1\b)\d+' and it should certainly exclude files in tools.