Re: [PATCH 2/3] serial: 8250_mxpcie: fail the probe when a port cannot be registered
From: Andy Shevchenko
Date: Tue Aug 18 2026 - 09:19:23 EST
On Tue, Aug 18, 2026 at 05:39:17PM +0800, Linmao Li wrote:
> When serial8250_register_8250_port() fails the loop only breaks out and
> the probe still returns success. The entries it did not reach keep the
> zero devm_kzalloc() left there, and the entry that failed keeps a
> negative error code.
>
> mxpcie8250_remove() then feeds all of them to
> serial8250_unregister_port(), which checks neither: line 0 unregisters a
> port this driver does not own, and the negative line indexes
> serial8250_ports[] out of bounds.
>
> Fail the probe instead, unregistering the ports registered so far.
This is behavioural difference. Before it was "register as much ports as we
can", now "don't register even a single one". If one of those UARTs worked in
the previous case for whatever reason, this patch will break that.
--
With Best Regards,
Andy Shevchenko