summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2020-12-16 05:44:40 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-16 07:46:17 +0100
commit47ca69b85821e150cfbbe86a18a038e9488c0090 (patch)
treeb2781637fe9c18b3d96fe76ff76fa2bea82d82df /scripts
parentcheckpatch: extend attributes check to handle more patterns (diff)
downloadlinux-47ca69b85821e150cfbbe86a18a038e9488c0090.tar.xz
linux-47ca69b85821e150cfbbe86a18a038e9488c0090.zip
checkpatch: add a fixer for missing newline at eof
Remove the trailing error message from the fixed lines. Link: https://lkml.kernel.org/r/20201017142546.28988-1-trix@redhat.com Signed-off-by: Tom Rix <trix@redhat.com> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rwxr-xr-xscripts/checkpatch.pl7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92949b8c5c76..7800a090e8fe 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3418,8 +3418,11 @@ sub process {
# check for adding lines without a newline.
if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
- WARN("MISSING_EOF_NEWLINE",
- "adding a line without newline at end of file\n" . $herecurr);
+ if (WARN("MISSING_EOF_NEWLINE",
+ "adding a line without newline at end of file\n" . $herecurr) &&
+ $fix) {
+ fix_delete_line($fixlinenr+1, "No newline at end of file");
+ }
}
# check we are in a valid source file C or perl if not then ignore this hunk