[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1464970582.11800.13.camel@perches.com>
Date: Fri, 03 Jun 2016 09:16:22 -0700
From: Joe Perches <joe@...ches.com>
To: Nishanth Menon <nm@...com>, "Andrew F. Davis" <afd@...com>,
Andy Whitcroft <apw@...onical.com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] checkpatch: Flag code that returns a negative number
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.
Powered by blists - more mailing lists