From: Andy Whitcroft <apw@shadowen.org>
Date: Tue, 6 Jan 2009 22:41:16 +0000 (-0800)
Subject: checkpatch: comment detection may miss an implied comment on the last hunk
X-Git-Tag: firefly_0821_release~16254
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=721c1cb60e0546d2e71b9aa50426c94e69c6521a;p=firefly-linux-kernel-4.4.55.git

checkpatch: comment detection may miss an implied comment on the last hunk

When detecting implied comments from leading stars we may incorrectly
think we have detected an edge one way or the other when we have not if we
drop off the end of the last hunk.  Fix this up.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 826cdbac0114..7c17e95bf36f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1097,8 +1097,8 @@ sub process {
 					 $rawlines[$ln - 1] =~ /^-/);
 				$cnt--;
 				#print "RAW<$rawlines[$ln - 1]>\n";
-				($edge) = (defined $rawlines[$ln - 1] &&
-					$rawlines[$ln - 1] =~ m@(/\*|\*/)@);
+				last if (!defined $rawlines[$ln - 1]);
+				($edge) = ($rawlines[$ln - 1] =~ m@(/\*|\*/)@);
 				last if (defined $edge);
 			}
 			if (defined $edge && $edge eq '*/') {