From 86e4a3ae05fbc16198ab63c2cfab0b72e0f8d1df Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Wed, 13 Jul 2022 16:32:45 +0200 Subject: [PATCH] lint/checkpatch: Update 'check for adding lines without a newline' This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas Change-Id: I1bd68e9a6609a3dfa7dc856f24e4b616714d9990 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65826 Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth --- util/lint/checkpatch.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index 92a35e6cd7..a8ecff4e71 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -3329,8 +3329,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