]> git.sur5r.net Git - u-boot/commitdiff
serial: serial_msm: fail probe if settings clocks fails
authorRamon Fried <ramon.fried@gmail.com>
Wed, 16 May 2018 09:13:37 +0000 (12:13 +0300)
committerTom Rini <trini@konsulko.com>
Sat, 26 May 2018 16:46:50 +0000 (12:46 -0400)
Failure to set the clocks will causes data abort exception when
trying to write to AHB uart registers.
This patch ensures that we don't touch these registers if clock
setting failed.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/serial/serial_msm.c

index 119e6b9846d002b117d61ef6e1169c539f108c9a..8b585deeeb537587c00f1f48543989d68895f64d 100644 (file)
@@ -181,10 +181,12 @@ static int msm_uart_clk_init(struct udevice *dev)
 
 static int msm_serial_probe(struct udevice *dev)
 {
+       int ret;
        struct msm_serial_data *priv = dev_get_priv(dev);
 
-       msm_uart_clk_init(dev); /* Ignore return value and hope clock was
-                                 properly initialized by earlier loaders */
+       ret = msm_uart_clk_init(dev);
+       if (ret)
+               return ret;
 
        if (readl(priv->base + UARTDM_SR) & UARTDM_SR_UART_OVERRUN)
                writel(UARTDM_CR_CMD_RESET_ERR, priv->base + UARTDM_CR);