From: Andy Whitcroft Correct calculation of the number of lines of condition where we have suspect indent. Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN scripts/checkpatch.pl~checkpatch-suspect-indent-count-condition-lines-correctly scripts/checkpatch.pl --- a/scripts/checkpatch.pl~checkpatch-suspect-indent-count-condition-lines-correctly +++ a/scripts/checkpatch.pl @@ -1417,7 +1417,8 @@ sub process { $s =~ s/\n./\n/gs; # Find out how long the conditional actually is. - my $cond_lines = 0 + $c =~ /\n/gs; + my @newlines = ($c =~ /\n/gs); + my $cond_lines = 1 + $#newlines; # We want to check the first line inside the block # starting at the end of the conditional, so remove: _