diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1e7d2cdd0c200ada7397bb187d8442c99d52ea20..c6782ac6f130b5c8d83c7b72d9b38743adff2256 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1295,7 +1295,11 @@ sub process { } } if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && - $line !~ /\G(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$/g) { + $line !~ /\G(?: + (?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$| + \s*return\s+ + )/xg) + { ERROR("trailing statements should be on next line\n" . $herecurr); }