Skip to content

Commit

Permalink
checkpatch: correctly stop scanning at the bottom of a hunk
Browse files Browse the repository at this point in the history
We are allowing context scanning checks to apply against the first line of
context outside at the end of the hunk.  This can lead to false matches to
patch names leading to various perl warnings.  Correctly stop at the
bottom of the hunk.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
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 Oct 29, 2009
1 parent 9a974fd commit cc77cdc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,6 @@ sub process {
$linenr++;

my $rawline = $rawlines[$linenr - 1];
my $hunk_line = ($realcnt != 0);

#extract the line range in the file after the patch is applied
if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
Expand Down Expand Up @@ -1274,6 +1273,8 @@ sub process {
$realcnt--;
}

my $hunk_line = ($realcnt != 0);

#make up the handle for any error we report on this line
$prefix = "$filename:$realline: " if ($emacs && $file);
$prefix = "$filename:$linenr: " if ($emacs && !$file);
Expand Down

0 comments on commit cc77cdc

Please sign in to comment.