From d8ac9d4585a85f5631f140bdd4b1d251feb4441a Mon Sep 17 00:00:00 2001
From: Gregory Bean <gbean@codeaurora.org>
Date: Mon, 17 Oct 2011 12:27:01 -0700
Subject: [PATCH] checkpatch: repair faulty executable-bit check.

Existing executable-bit test only works on second and later files
contained in the patch.  Correct this so all patches in the file
are tested.

Change-Id: Ie9363473f0d2fc067f9c593c86495d15e8e5d546
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit 246e1f183dd3c2bfe63722ca5b207473cb9a0219)

Conflicts:

	scripts/checkpatch.pl
---
 scripts/checkpatch.pl | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c004a5931f4d..13571b9c2d65 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1451,7 +1451,6 @@ sub process {
 	my @setup_docs = ();
 	my $setup_docs = 0;
 
-	my $in_code_block = 0;
 	my $exec_file = "";
 
 	my $shorttext = BEFORE_SHORTTEXT;
@@ -1599,6 +1598,7 @@ sub process {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@;
 			$in_commit_log = 0;
+			$exec_file = $realfile;
 		} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@;
@@ -1615,16 +1615,14 @@ sub process {
 				ERROR("MODIFIED_INCLUDE_ASM",
 				      "do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");
 			}
-			$in_code_block = 1;
+			$exec_file = "";
 			next;
 		}
 		elsif ($rawline =~ /^diff.+a\/(.+)\sb\/.+$/) {
 			$exec_file = $1;
-			$in_code_block = 0;
 		}
 		#Check state to make sure we aren't in code block.
-		elsif  (!$in_code_block			   &&
-			($exec_file =~ /^.+\.[chS]$/ or
+		elsif  (($exec_file =~ /^.+\.[chS]$/ or
 			 $exec_file =~ /^.+\.txt$/ or
 			 $exec_file =~ /^.+\.ihex$/ or
 			 $exec_file =~ /^.+\.hex$/ or