]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
checkpatch: improve return negative errno check
authorJoe Perches <joe@perches.com>
Thu, 16 Apr 2015 19:44:19 +0000 (12:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 13:03:57 +0000 (09:03 -0400)
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>
scripts/checkpatch.pl

index 5748c35d034263f44645e42df7a6a7b831dac6d3..45babf2243f3e9da1e1ff81cab892d010c1f90f4 100755 (executable)
@@ -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);
                        }
                }