]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tty: xilinx_uartps: Check the clk_enable return value
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Fri, 29 Jul 2022 11:47:48 +0000 (17:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Aug 2022 11:26:01 +0000 (13:26 +0200)
Check the clk_enable return value.
If clocks are not enabled the register accesses could hang the
system so error out instead.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/20220729114748.18332-8-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/xilinx_uartps.c

index da83ae6df1e082ceb1e984184f5c1a42e86d294d..606429b850177c04d6e25bab48f991e190fa89a3 100644 (file)
@@ -1420,9 +1420,17 @@ static int __maybe_unused cdns_runtime_resume(struct device *dev)
 {
        struct uart_port *port = dev_get_drvdata(dev);
        struct cdns_uart *cdns_uart = port->private_data;
+       int ret;
+
+       ret = clk_enable(cdns_uart->pclk);
+       if (ret)
+               return ret;
 
-       clk_enable(cdns_uart->pclk);
-       clk_enable(cdns_uart->uartclk);
+       ret = clk_enable(cdns_uart->uartclk);
+       if (ret) {
+               clk_disable(cdns_uart->pclk);
+               return ret;
+       }
        return 0;
 };