From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linmao Li <lilinmao@kylinos.cn>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Crescent Hsieh <crescentcy.hsieh@moxa.com>,
Lukas Wunner <lukas@wunner.de>,
Gerhard Engleder <gerhard@engleder-embedded.com>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] serial: 8250_mxpcie: only unregister the ports that were registered
Date: Tue, 1 Sep 2026 12:00:19 +0300 [thread overview]
Message-ID: <apaUI8OdGQZ_dJ5O@ashevche-desk.local> (raw)
In-Reply-To: <20260901041519.114737-3-lilinmao@kylinos.cn>
On Tue, Sep 01, 2026 at 12:15:18PM +0800, Linmao Li wrote:
> When serial8250_register_8250_port() fails the loop stops and the probe
> keeps the ports registered so far, like pciserial_init_ports() in
> 8250_pci.c this driver was split from. What the split lost is that
> function's priv->nr: mxpcie8250_remove() walks all num_ports entries,
> but the ones the loop never reached keep the zero devm_kzalloc() left
> there, and the one that failed keeps a negative error code.
>
> serial8250_unregister_port() checks neither, so removal unregisters
> line 0 - a port this driver does not own - and indexes
> serial8250_ports[] with a negative line number.
>
> Record how many ports were registered and unregister only those.
...
> struct mxpcie8250 {
> unsigned int supp_rs;
> unsigned int num_ports;
> + unsigned int nr; /* ports actually registered */
I would make it indented with the below comments.
But no need to resend for this. It's not critical at all.
> void __iomem *bar1_base; /* UART registers (MMIO) */
> void __iomem *bar2_base; /* UIR / GPIO / CPLD (IO) */
> struct mxpcie8250_port port[] __counted_by(num_ports);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-09-01 9:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 4:15 [PATCH v2 0/3] serial: 8250_mxpcie: probe and console fixes Linmao Li
2026-09-01 4:15 ` [PATCH v2 1/3] serial: 8250_mxpcie: set the driver data before registering ports Linmao Li
2026-09-01 4:15 ` [PATCH v2 2/3] serial: 8250_mxpcie: only unregister the ports that were registered Linmao Li
2026-09-01 9:00 ` Andy Shevchenko [this message]
2026-09-01 4:15 ` [PATCH v2 3/3] serial: 8250_mxpcie: take the line settings from the new termios Linmao Li
2026-09-01 9:01 ` [PATCH v2 0/3] serial: 8250_mxpcie: probe and console fixes Andy Shevchenko
2026-09-02 2:22 ` Crescent Hsieh
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=apaUI8OdGQZ_dJ5O@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=crescentcy.hsieh@moxa.com \
--cc=gerhard@engleder-embedded.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=lilinmao@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lukas@wunner.de \
/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®