[PATCH] serial: auart: check clk_enable() return in console write

Frank Li Frank.li at nxp.com
Mon Mar 2 13:47:34 PST 2026


On Sun, Mar 01, 2026 at 04:22:56PM +0000, Zhaoyang Yu wrote:
> Add a check for clk_enable() in auart_console_write(). If
> clk_enable() fails, return immediately to avoid accessing
> hardware registers while the clock is not enabled.
>
> Signed-off-by: Zhaoyang Yu <2426767509 at qq.com>
> ---

Reviewed-by: Frank Li <Frank.Li at nxp.com>

>  drivers/tty/serial/mxs-auart.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
> index cc65c9fb6446..693b491f1e75 100644
> --- a/drivers/tty/serial/mxs-auart.c
> +++ b/drivers/tty/serial/mxs-auart.c
> @@ -1318,7 +1318,8 @@ auart_console_write(struct console *co, const char *str, unsigned int count)
>  	s = auart_port[co->index];
>  	port = &s->port;
>
> -	clk_enable(s->clk);
> +	if (clk_enable(s->clk))
> +		return;
>
>  	/* First save the CR then disable the interrupts */
>  	old_ctrl2 = mxs_read(s, REG_CTRL2);
> --
> 2.34.1
>



More information about the linux-arm-kernel mailing list