From: Christian Marangi <ansuelsmth@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] checkpatch: report warning with files ending with blank lines
Date: Wed, 7 Oct 2026 19:54:52 +0200 [thread overview]
Message-ID: <6ac6876f.31081df4.3ada42.ff1e@mx.google.com> (raw)
In-Reply-To: <a098c4e66a4cabd61b8a7c933db7f21ad5648d5b.camel@perches.com>
On Wed, Oct 07, 2026 at 10:50:30AM -0700, Joe Perches wrote:
> On Wed, 2026-10-07 at 18:52 +0200, Christian Marangi wrote:
> > On Wed, Oct 07, 2026 at 09:49:48AM -0700, Joe Perches wrote:
> > On Wed, 2026-10-07 at 14:28 +0200, Christian Marangi wrote:
> > > > On applying patch, git, depending on the default configuration, might
> > > > complain for any file having blank lines at end of file.
> > > I was not clear enough in my first reply.
> > >
> > > I meant that the test should be done only once, not
> > > for each line of the input.
> > >
> > > After the end of the process() loop of
> > >
> > foreach my $rawline (@rawlines) {
> > [...]
> > }
> > >
> > > a single test of $rawlines[-1] could be done.
> >
> > Yes I also was with that idea but then I quickly figure it out that we are
> > not testing if the .patch have blank line at EOF. But if the single file of
> > the patch have blank line at EOF.
> >
> > That can only be done in the process() while scanning each line as it does
> > progressively check new files in it.
> >
> > (unless I'm missing something)
>
> Dunno. Maybe I'm missing something but maybe something like this:
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index f424dafce5bce..d2f99127a9a9a 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -7850,6 +7850,13 @@ sub process {
> exit(0);
> }
>
> + # check if the last line is a blank line
> + if (($is_patch && $rawlines[-1] =~ /^\+\s*$/) ||
> + (!$is_patch && $rawlines[-1] =~ /^\s*$/)) {
> + WARN("LINE_SPACING",
> + "Blank lines at EOF are not good\n");
> + }
> +
> # In mailback mode only produce a report in the negative, for
> # things that appear to be patches.
> if ($mailback && ($clean == 1 || !$is_patch)) {
Yes if you think about this, this will read the last line of the .patch,
not the last line of a new file that will be generated by the .patch.
diff --git a/MAINTAINERS b/MAINTAINERS
index 70a11f2ff61d..0b9946c532af 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -785,3 +785,9 @@ S: Maintained
F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml
F: drivers/spi/spi-airoha-snfi.c
+AIROHA USB PHY DRIVER
+M: Christian Marangi <ansuelsmth@gmail.com>
+L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S: Maintained
+F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml
+
--
2.55.0
It's to catch situation like this. Example for entire new file or adding
stuff at the end of a file, where a new line is introduced.
git am will complain about this.
--
Ansuel
next prev parent reply other threads:[~2026-10-07 17:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 12:28 Christian Marangi
2026-10-07 16:49 ` Joe Perches
2026-10-07 16:52 ` Christian Marangi
2026-10-07 17:50 ` Joe Perches
2026-10-07 17:54 ` Christian Marangi [this message]
2026-10-07 18:30 ` Joe Perches
2026-10-07 18:31 ` Christian Marangi
2026-10-07 18:48 ` Joe Perches
2026-10-07 18:50 ` Christian Marangi (Ansuel)
2026-10-07 17:58 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ac6876f.31081df4.3ada42.ff1e@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®