summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>2022-07-29 14:47:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-30 14:26:01 +0300
commita000bafa61829d8c4d8219bc7d6918d907af91e5 (patch)
tree8b83e7b0d20cf46b024a270794bd7864a259e83f /drivers
parenta17fa1216c23bf28819bb957f71f1bab914ba9a8 (diff)
downloadlinux-a000bafa61829d8c4d8219bc7d6918d907af91e5.tar.xz
tty: xilinx_uartps: Check the clk_enable return value
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/xilinx_uartps.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index da83ae6df1e0..606429b85017 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -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;
};