Skip to content

Commit 60f3617

Browse files
l1kgregkh
authored andcommitted
serial: fsl_lpuart: Reset prior to registration
Since commit bd5305d ("tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp"), certain i.MX UARTs are reset after they've already been registered. Register state may thus be clobbered after user space has begun to open and access the UART. Avoid by performing the reset prior to registration. Fixes: bd5305d ("tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp") Cc: stable@vger.kernel.org # v5.15+ Cc: Fugang Duan <fugang.duan@nxp.com> Cc: Sherry Sun <sherry.sun@nxp.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Lukas Wunner <lukas@wunner.de> Link: https://lore.kernel.org/r/72fb646c1b0b11c989850c55f52f9ff343d1b2fa.1662884345.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1d10cd4 commit 60f3617

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/tty/serial/fsl_lpuart.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,14 +2724,15 @@ static int lpuart_probe(struct platform_device *pdev)
27242724
lpuart_reg.cons = LPUART_CONSOLE;
27252725
handler = lpuart_int;
27262726
}
2727-
ret = uart_add_one_port(&lpuart_reg, &sport->port);
2728-
if (ret)
2729-
goto failed_attach_port;
27302727

27312728
ret = lpuart_global_reset(sport);
27322729
if (ret)
27332730
goto failed_reset;
27342731

2732+
ret = uart_add_one_port(&lpuart_reg, &sport->port);
2733+
if (ret)
2734+
goto failed_attach_port;
2735+
27352736
ret = uart_get_rs485_mode(&sport->port);
27362737
if (ret)
27372738
goto failed_get_rs485;
@@ -2747,9 +2748,9 @@ static int lpuart_probe(struct platform_device *pdev)
27472748

27482749
failed_irq_request:
27492750
failed_get_rs485:
2750-
failed_reset:
27512751
uart_remove_one_port(&lpuart_reg, &sport->port);
27522752
failed_attach_port:
2753+
failed_reset:
27532754
lpuart_disable_clks(sport);
27542755
return ret;
27552756
}

0 commit comments

Comments
 (0)