]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
serial: tegra: handle clk prepare error in tegra_uart_hw_init()
authorYi Yang <yiyang13@huawei.com>
Thu, 17 Aug 2023 10:54:06 +0000 (18:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:33 +0000 (09:48 +0200)
[ Upstream commit 5abd01145d0cc6cd1b7c2fe6ee0b9ea0fa13671e ]

In tegra_uart_hw_init(), the return value of clk_prepare_enable() should
be checked since it might fail.

Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
Link: https://lore.kernel.org/r/20230817105406.228674-1-yiyang13@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/serial-tegra.c

index 1cf08b33456c97f8d1b9e580878a4a154f71a5b1..37e1e05bc87e6b5760915b6ba45a7e0e9ca594b6 100644 (file)
@@ -998,7 +998,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
        tup->ier_shadow = 0;
        tup->current_baud = 0;
 
-       clk_prepare_enable(tup->uart_clk);
+       ret = clk_prepare_enable(tup->uart_clk);
+       if (ret) {
+               dev_err(tup->uport.dev, "could not enable clk\n");
+               return ret;
+       }
 
        /* Reset the UART controller to clear all previous status.*/
        reset_control_assert(tup->rst);