]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
serial: auart: check clk_enable() return in console write
authorZhaoyang Yu <2426767509@qq.com>
Sun, 1 Mar 2026 16:22:56 +0000 (16:22 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Mar 2026 14:24:23 +0000 (15:24 +0100)
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@qq.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/tencent_AB29FADF1FAD67D818283B6BB4FDF66F2F08@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/mxs-auart.c

index cc65c9fb6446c240d50ac2d12890ffa4f23aa65f..693b491f1e755d19cb8c7a12f2bb78ab2b1d775f 100644 (file)
@@ -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);