summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/checkpatch.pl16
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7ec8846ac9..ec0aa4cd93 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2547,12 +2547,16 @@ sub process {
 					$line !~ /\#\s*else/) {
 			my $allowed = 0;
 
-			# Check the pre-context.
-			if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
-                            print "APW: ALLOWED: pre<$pre> line<$line>\n"
-                                if $dbg_adv_apw;
-                            $allowed = 1;
-			}
+                        # Check the pre-context.
+                        if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
+                            my $pre = $1;
+
+                            if ($line !~ /else/) {
+                                print "APW: ALLOWED: pre<$pre> line<$line>\n"
+                                    if $dbg_adv_apw;
+                                $allowed = 1;
+                            }
+                        }
 
 			my ($level, $endln, @chunks) =
 				ctx_statement_full($linenr, $realcnt, $-[0]);