[U-Boot] [PATCH 2/7] serial: serial_msm: fail probe if settings clocks fails
Simon Glass
sjg at chromium.org
Sun May 13 22:00:09 UTC 2018
Hi Ramon,
On 12 May 2018 at 20:15, Ramon Fried <ramon.fried at gmail.com> wrote:
> 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 at gmail.com>
> ---
> drivers/serial/serial_msm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c
> index 119e6b9846..250e48c996 100644
> --- a/drivers/serial/serial_msm.c
> +++ b/drivers/serial/serial_msm.c
> @@ -183,8 +183,8 @@ static int msm_serial_probe(struct udevice *dev)
> {
> 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 */
> + if (msm_uart_clk_init(dev))
> + return -EINVAL;
Would it not be better to return the error that msm_uart_clk_init()
returns, rather than -EINVAL?
>
> if (readl(priv->base + UARTDM_SR) & UARTDM_SR_UART_OVERRUN)
> writel(UARTDM_CR_CMD_RESET_ERR, priv->base + UARTDM_CR);
> --
> 2.14.1
>
Regards,
Simon
More information about the U-Boot
mailing list