Skip to content

Commit

Permalink
checkpatch: handle missing #if open in context
Browse files Browse the repository at this point in the history
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 <apw@canonical.com>
Tested-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andy Whitcroft authored and Linus Torvalds committed Jan 16, 2009
1 parent c91192d commit a275064
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a275064

Please sign in to comment.