From: Joe Perches <joe@perches.com>
To: Nishanth Menon <nm@ti.com>, "Andrew F. Davis" <afd@ti.com>,
Andy Whitcroft <apw@canonical.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] checkpatch: Flag code that returns a negative number
Date: Fri, 03 Jun 2016 09:16:22 -0700 [thread overview]
Message-ID: <1464970582.11800.13.camel@perches.com> (raw)
In-Reply-To: <5751AB4A.7040805@ti.com>
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.
next prev parent reply other threads:[~2016-06-03 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 15:25 [PATCH] checkpatch: Flag code that returns a negative number Nishanth Menon
2016-06-03 15:41 ` Joe Perches
2016-06-03 15:49 ` Andrew F. Davis
2016-06-03 16:01 ` Joe Perches
2016-06-03 16:07 ` Nishanth Menon
2016-06-03 16:16 ` Joe Perches [this message]
2016-06-03 20:02 ` [PATCH V2] checkpatch: Flag code that returns a negative number less than 1 Nishanth Menon
2016-06-03 20:42 ` Joe Perches
2016-06-03 20:46 ` Nishanth Menon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464970582.11800.13.camel@perches.com \
--to=joe@perches.com \
--cc=afd@ti.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nm@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox