Re: [PATCH] checkpatch: Flag code that returns a negative number
From: Nishanth Menon
Date: Fri Jun 03 2016 - 12:07:47 EST
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