diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9e4ba9fa9bc89541b4712a8caece012f5f3798c3..fad2116f51a445b005617ba568d7d45e52dc21f0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1642,6 +1642,8 @@ sub process { my $non_utf8_charset = 0; + my $last_blank_line = 0; + our @report = (); our $cnt_lines = 0; our $cnt_error = 0; @@ -2308,6 +2310,15 @@ sub process { "Please use a blank line after function/struct/union/enum declarations\n" . $hereprev); } +# check for multiple consecutive blank lines + if ($prevline =~ /^[\+ ]\s*$/ && + $line =~ /^\+\s*$/ && + $last_blank_line != ($linenr - 1)) { + CHK("LINE_SPACING", + "Please don't use multiple blank lines\n" . $hereprev); + $last_blank_line = $linenr; + } + # check for missing blank lines after declarations if ($sline =~ /^\+\s+\S/ && #Not at char 1 # actual declarations