Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413344

Re: [PATCH] checkpatch: Flag code that returns a negative number

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] checkpatch: Flag code that returns a negative number
Date 2016-06-03 18:20 +0200
Message-ID <rFZZf-5w1-9@gated-at.bofh.it> (permalink)
References <rFZcS-4YZ-13@gated-at.bofh.it> <rFZwe-57d-11@gated-at.bofh.it> <rFZwd-57d-9@gated-at.bofh.it> <rFZPz-5sI-5@gated-at.bofh.it> <rFZPA-5sI-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] checkpatch: Flag code that returns a negative number Nishanth Menon <nm@ti.com> - 2016-06-03 17:30 +0200
  Re: [PATCH] checkpatch: Flag code that returns a negative number "Andrew F. Davis" <afd@ti.com> - 2016-06-03 17:50 +0200
    Re: [PATCH] checkpatch: Flag code that returns a negative number Joe Perches <joe@perches.com> - 2016-06-03 18:10 +0200
      Re: [PATCH] checkpatch: Flag code that returns a negative number Nishanth Menon <nm@ti.com> - 2016-06-03 18:10 +0200
        Re: [PATCH] checkpatch: Flag code that returns a negative number Joe Perches <joe@perches.com> - 2016-06-03 18:20 +0200
  Re: [PATCH] checkpatch: Flag code that returns a negative number Joe Perches <joe@perches.com> - 2016-06-03 17:50 +0200
  [PATCH V2] checkpatch: Flag code that returns a negative number less than 1 Nishanth Menon <nm@ti.com> - 2016-06-03 22:10 +0200
    Re: [PATCH V2] checkpatch: Flag code that returns a negative number  less than 1 Joe Perches <joe@perches.com> - 2016-06-03 22:50 +0200
      Re: [PATCH V2] checkpatch: Flag code that returns a negative number  less than 1 Nishanth Menon <nm@ti.com> - 2016-06-03 22:50 +0200

csiph-web