diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 0cf8b98d8dc9..fc72d64cd2d4 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2450,6 +2450,16 @@ sub process { | |||
2450 | } | 2450 | } |
2451 | } | 2451 | } |
2452 | 2452 | ||
2453 | # check indentation of a line with a break; | ||
2454 | # if the previous line is a goto or return and is indented the same # of tabs | ||
2455 | if ($sline =~ /^\+([\t]+)break\s*;\s*$/) { | ||
2456 | my $tabs = $1; | ||
2457 | if ($prevline =~ /^\+$tabs(?:goto|return)\b/) { | ||
2458 | WARN("UNNECESSARY_BREAK", | ||
2459 | "break is not useful after a goto or return\n" . $hereprev); | ||
2460 | } | ||
2461 | } | ||
2462 | |||
2453 | # discourage the addition of CONFIG_EXPERIMENTAL in #if(def). | 2463 | # discourage the addition of CONFIG_EXPERIMENTAL in #if(def). |
2454 | if ($line =~ /^\+\s*\#\s*if.*\bCONFIG_EXPERIMENTAL\b/) { | 2464 | if ($line =~ /^\+\s*\#\s*if.*\bCONFIG_EXPERIMENTAL\b/) { |
2455 | WARN("CONFIG_EXPERIMENTAL", | 2465 | WARN("CONFIG_EXPERIMENTAL", |