diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-07-14 18:13:41 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-07-14 18:13:41 +0200 |
commit | 03fe805a098422d27cbbbad29a54ff1349da3622 (patch) | |
tree | 0db9cc9a701203ddcee58e5b907d4fb8ad31b421 /scripts/checkpatch.pl | |
parent | 50dd9050e45ce11c575eabcaee8a914caf78fb74 (diff) | |
parent | 5646eda5851e6cfdfa22d41895e3f5daffa643d3 (diff) |
Merge branch 'topic/monotonic' into for-next
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 010b18ef4ea..182be0f1240 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3476,12 +3476,17 @@ sub process { } } -# unnecessary return in a void function? (a single leading tab, then return;) - if ($sline =~ /^\+\treturn\s*;\s*$/ && - $prevline =~ /^\+/) { +# unnecessary return in a void function +# at end-of-function, with the previous line a single leading tab, then return; +# and the line before that not a goto label target like "out:" + if ($sline =~ /^[ \+]}\s*$/ && + $prevline =~ /^\+\treturn\s*;\s*$/ && + $linenr >= 3 && + $lines[$linenr - 3] =~ /^[ +]/ && + $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) { WARN("RETURN_VOID", - "void function return statements are not generally useful\n" . $herecurr); - } + "void function return statements are not generally useful\n" . $hereprev); + } # if statements using unnecessary parentheses - ie: if ((foo == bar)) if ($^V && $^V ge 5.10.0 && |