summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuanjun Gong <ruc_gongyuanjun@163.com>2023-07-17 22:47:33 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-30 13:53:19 +0200
commit130a9571aee966ad8ba65719fe6c32db7b26db6a (patch)
tree1f8e6e7416e966c47accbe55951017eae087a4c7
parent17be181b061b4b7b72d4ffb856d94a356592bfd7 (diff)
downloadlinux-stable-130a9571aee966ad8ba65719fe6c32db7b26db6a.tar.gz
linux-stable-130a9571aee966ad8ba65719fe6c32db7b26db6a.tar.bz2
linux-stable-130a9571aee966ad8ba65719fe6c32db7b26db6a.zip
drivers:tty: fix return value check in asc_init_port
in asc_init_port, clk_prepare_enable may fail, therefore, the return value of clk_prepare_enable should be checked. Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> Link: https://lore.kernel.org/r/20230717144733.24194-1-ruc_gongyuanjun@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/st-asc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index b8954f0bba8f..92b9f6894006 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -703,7 +703,9 @@ static int asc_init_port(struct asc_port *ascport,
if (WARN_ON(IS_ERR(ascport->clk)))
return -EINVAL;
/* ensure that clk rate is correct by enabling the clk */
- clk_prepare_enable(ascport->clk);
+ ret = clk_prepare_enable(ascport->clk);
+ if (ret)
+ return ret;
ascport->port.uartclk = clk_get_rate(ascport->clk);
WARN_ON(ascport->port.uartclk == 0);
clk_disable_unprepare(ascport->clk);