summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2009-01-15 22:51:04 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-16 01:39:38 +0100
commita27506459c5e6ccc8437fca0adb6d3759c883c28 (patch)
tree7ebce7fae5d7d989952bbc152aa270043445ab1c /scripts/checkpatch.pl
parentnbd: do not allow two clients at the same time (diff)
downloadlinux-a27506459c5e6ccc8437fca0adb6d3759c883c28.tar.xz
linux-a27506459c5e6ccc8437fca0adb6d3759c883c28.zip
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 <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>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl4
1 files changed, 3 insertions, 1 deletions
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.