The patch titled Subject: checkpatch: add --strict test for switch/default missing break has been added to the -mm tree. Its filename is checkpatch-add-strict-test-for-switch-default-missing-break.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Joe Perches <joe@xxxxxxxxxxx> Subject: checkpatch: add --strict test for switch/default missing break switch default case is sometimes written as "default:;". This can cause new cases added below the default to be defective. Suggest adding a break; after empty default cases to avoid fallthrough defects. Fixed indentation in the other semicolon test above it. Suggested-by: Peter Senna Tschudin <peter.senna@xxxxxxxxx> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> Cc: Andy Whitcroft <apw@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/checkpatch.pl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff -puN scripts/checkpatch.pl~checkpatch-add-strict-test-for-switch-default-missing-break scripts/checkpatch.pl --- a/scripts/checkpatch.pl~checkpatch-add-strict-test-for-switch-default-missing-break +++ a/scripts/checkpatch.pl @@ -3450,8 +3450,22 @@ sub process { # check for multiple semicolons if ($line =~ /;\s*;\s*$/) { - WARN("ONE_SEMICOLON", - "Statements terminations use 1 semicolon\n" . $herecurr); + WARN("ONE_SEMICOLON", + "Statements terminations use 1 semicolon\n" . $herecurr); + } + +# check for switch/default statements without a break; + if ($^V && $^V ge 5.10.0 && + defined $stat && + $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) { + my $ctx = ''; + my $herectx = $here . "\n"; + my $cnt = statement_rawlines($stat); + for (my $n = 0; $n < $cnt; $n++) { + $herectx .= raw_line($linenr, $n) . "\n"; + } + WARN("DEFAULT_NO_BREAK", + "switch default: should use break\n" . $herectx); } # check for gcc specific __FUNCTION__ _ Patches currently in -mm which might be from joe@xxxxxxxxxxx are origin.patch linux-next.patch printk-boot_delay-should-only-affect-output.patch maintainers-chinese-maintainers-mailing-list-is-subscribers-only.patch checkpatch-warn-on-unnecessary-line-continuations.patch checkpatch-warn-about-using-config_experimental.patch checkpatch-remove-reference-to-feature-removal-scheduletxt.patch checkpatch-consolidate-if-foo-barfoo-checks-and-add-debugfs_remove.patch checkpatch-allow-control-over-line-length-warning-default-remains-80.patch checkpatch-extend-line-continuation-test.patch checkpatch-add-strict-messages-for-blank-lines-around-braces.patch checkpatch-warn-when-declaring-struct-spinlock-foo.patch checkpatch-add-strict-test-for-switch-default-missing-break.patch kstrto-add-documentation.patch simple_strto-annotate-function-as-obsolete.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html