From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932779AbcFCQHo (ORCPT ); Fri, 3 Jun 2016 12:07:44 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:44837 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932182AbcFCQHn (ORCPT ); Fri, 3 Jun 2016 12:07:43 -0400 Subject: Re: [PATCH] checkpatch: Flag code that returns a negative number To: Joe Perches , "Andrew F. Davis" , Andy Whitcroft 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> CC: , Andrew Morton From: Nishanth Menon Message-ID: <5751AB4A.7040805@ti.com> Date: Fri, 3 Jun 2016 11:07:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1464969664.11800.9.camel@perches.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -- Regards, Nishanth Menon