aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-08-06 19:11:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:29 -0400
commite81f239b4db2ad6c4b029ed92f0222601ce42abe (patch)
treee031acf2105cba2579c89556e80c0143a54b75f0 /scripts
parent1813087dbc54ff1485bcc84b66d34052eaf23387 (diff)
checkpatch: fix false positive MISSING_BREAK warnings with --file
Using --file mode can give false positives with MISSING_BREAK fall-through warnings on simple but long multiple consecutive case statements. Look for all lines before a case statement for a switch or a statement when using --file mode. Fix a misspelling of preceded while there. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Lee Jones <lee.jones@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 10384cf40691..a0880ede3db9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4811,13 +4811,13 @@ sub process {
4811 } 4811 }
4812 } 4812 }
4813 4813
4814# check for case / default statements not preceeded by break/fallthrough/switch 4814# check for case / default statements not preceded by break/fallthrough/switch
4815 if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) { 4815 if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) {
4816 my $has_break = 0; 4816 my $has_break = 0;
4817 my $has_statement = 0; 4817 my $has_statement = 0;
4818 my $count = 0; 4818 my $count = 0;
4819 my $prevline = $linenr; 4819 my $prevline = $linenr;
4820 while ($prevline > 1 && $count < 3 && !$has_break) { 4820 while ($prevline > 1 && ($file || $count < 3) && !$has_break) {
4821 $prevline--; 4821 $prevline--;
4822 my $rline = $rawlines[$prevline - 1]; 4822 my $rline = $rawlines[$prevline - 1];
4823 my $fline = $lines[$prevline - 1]; 4823 my $fline = $lines[$prevline - 1];