From: Andy Whitcroft Date: Thu, 15 Jan 2009 21:51:04 +0000 (-0800) Subject: checkpatch: handle missing #if open in context X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a27506459c5e6ccc8437fca0adb6d3759c883c28;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git checkpatch: handle missing #if open in context If the #if opening statement is not in the context then the context stack can be empty. Handle this by ensuring there is always a blank entry in the stack. Signed-off-by: Andy Whitcroft Tested-by: Dhaval Giani Cc: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7bed4ed2c519..eefef65fa584 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -411,13 +411,15 @@ sub ctx_statement_block { my $type = ''; my $level = 0; - my @stack = ([$type, $level]); + my @stack = (); my $p; my $c; my $len = 0; my $remainder; while (1) { + @stack = (['', 0]) if ($#stack == -1); + #warn "CSB: blk<$blk> remain<$remain>\n"; # If we are about to drop off the end, pull in more # context.