Re: [PATCH 01/13] serial: linflexuart: Fix locking in set_termios
From: Frank Li
Date: Mon Feb 16 2026 - 15:17:29 EST
On Mon, Feb 16, 2026 at 04:01:53PM +0100, Larisa Grigore wrote:
> From: Radu Pirea <radu-nicolae.pirea@xxxxxxx>
>
> Take the port->lock when set_termios is called, otherwise if characters
> are sent while IP is in init mode, the IP will hang in an uncertain
> state.
According to patch, you move it before read(UARTCR). can explain why hang?
Frank
>
> Fixes: 09864c1cdf5c ("tty: serial: Add linflexuart driver for S32V234")
> Signed-off-by: Radu Pirea <radu-nicolae.pirea@xxxxxxx>
> Signed-off-by: Larisa Grigore <larisa.grigore@xxxxxxxxxxx>
> ---
> drivers/tty/serial/fsl_linflexuart.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_linflexuart.c
> index e70a56de1fce..5a410e2d56ac 100644
> --- a/drivers/tty/serial/fsl_linflexuart.c
> +++ b/drivers/tty/serial/fsl_linflexuart.c
> @@ -407,6 +407,8 @@ linflex_set_termios(struct uart_port *port, struct ktermios *termios,
> unsigned long cr, old_cr, cr1;
> unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
>
> + uart_port_lock_irqsave(port, &flags);
> +
> cr = readl(port->membase + UARTCR);
> old_cr = cr;
>
> @@ -475,8 +477,6 @@ linflex_set_termios(struct uart_port *port, struct ktermios *termios,
> cr &= ~LINFLEXD_UARTCR_PCE;
> }
>
> - uart_port_lock_irqsave(port, &flags);
> -
> port->read_status_mask = 0;
>
> if (termios->c_iflag & INPCK)
> --
> 2.47.0
>