diff options
-rwxr-xr-x | scripts/checkpatch.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2e513fdf3043..fe4553c070b1 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1128,6 +1128,7 @@ sub process { | |||
1128 | $linenr++; | 1128 | $linenr++; |
1129 | 1129 | ||
1130 | my $rawline = $rawlines[$linenr - 1]; | 1130 | my $rawline = $rawlines[$linenr - 1]; |
1131 | my $hunk_line = ($realcnt != 0); | ||
1131 | 1132 | ||
1132 | #extract the line range in the file after the patch is applied | 1133 | #extract the line range in the file after the patch is applied |
1133 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { | 1134 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { |
@@ -1238,8 +1239,8 @@ sub process { | |||
1238 | ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); | 1239 | ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); |
1239 | } | 1240 | } |
1240 | 1241 | ||
1241 | #ignore lines being removed | 1242 | # ignore non-hunk lines and lines being removed |
1242 | if ($line=~/^-/) {next;} | 1243 | next if (!$hunk_line || $line =~ /^-/); |
1243 | 1244 | ||
1244 | #trailing whitespace | 1245 | #trailing whitespace |
1245 | if ($line =~ /^\+.*\015/) { | 1246 | if ($line =~ /^\+.*\015/) { |