diff options
author | Joe Perches <joe@perches.com> | 2015-04-16 19:44:19 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 13:03:57 (GMT) |
commit | f34e4a4f979c0d39f741bc809127fcf2167a7389 (patch) | |
tree | 5b6c1eaa617df0d50841d58ef2ee38fc3c22144d /scripts/checkpatch.pl | |
parent | b392c64f59d7b088aefb4e86d208cd6d3b93eefb (diff) | |
download | linux-f34e4a4f979c0d39f741bc809127fcf2167a7389.tar.xz |
checkpatch: improve return negative errno check
Add a few conditions to the test to find
return (ERRNO);
Make the output message a bit less cryptic too.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 5748c35..45babf2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4009,12 +4009,12 @@ sub process { } } -# Return of what appears to be an errno should normally be -'ve - if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { +# Return of what appears to be an errno should normally be negative + if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) { my $name = $1; if ($name ne 'EOF' && $name ne 'ERROR') { WARN("USE_NEGATIVE_ERRNO", - "return of an errno should typically be -ve (return -$1)\n" . $herecurr); + "return of an errno should typically be negative (ie: return -$1)\n" . $herecurr); } } |