Re: [PATCH] serial: mvebu-uart: do not leave a stale port behind when probe fails

From: Miquel Raynal

Date: Wed Dec 02 2026 - 06:29:56 EST


On 01/12/2026 at 23:19:52 +04, Arina Kharlamova via B4 Relay <devnull+arina.kharlamova.mbzuai.ac.ae@xxxxxxxxxx> wrote:

> From: Arina Kharlamova <arina.kharlamova@xxxxxxxxxxxx>
>
> mvebu_uart_probe() stores the devm mapping in mvebu_uart_ports[] before
> it gets the clock and the interrupts. If one of them fails or defers,
> devres unmaps the registers and frees the private data, but the static
> port keeps membase, mapbase and private_data.
>
> mvebu_uart_console_setup() only checks membase and mapbase. When
> another port registers the console first, for example with
> console=ttyMV1 and ttyMV1 still waiting for its clock, the setup
> callback uses the stale port and accesses the unmapped registers.
>
> Keep the mapping in a local variable and store it in the port only
> after the last step that can fail before uart_add_one_port().
>
> Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")
> Signed-off-by: Arina Kharlamova <arina.kharlamova@xxxxxxxxxxxx>

Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>