Re: [PATCH] serial: 8250_dw: Emit an error message if getting the baudclk failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 22, 2024 at 4:50 PM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>
> Instead of silently giving up, at least tell what the problem is.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
>  drivers/tty/serial/8250/8250_dw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index 2d1f350a4bea..94aa3dddb71e 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -597,7 +597,8 @@ static int dw8250_probe(struct platform_device *pdev)
>         if (data->clk == NULL)
>                 data->clk = devm_clk_get_optional_enabled(dev, NULL);
>         if (IS_ERR(data->clk))
> -               return PTR_ERR(data->clk);
> +               return dev_err_probe(dev, PTR_ERR(data->clk),
> +                                    "failed to get baudclk\n");

Not required IMO as the baudclk is optional, otherwise it might ask
for a similar change at apb_pclk.
Could you please provide some insight into the circumstances that lead
to encountering this error case?

Also the check is for IS_ERR(data->clk), data-clk could be NULL aswell.

I see any error should be caught at the following line, provided no
clock-frequency
```
/* If no clock rate is defined, fail. */
if (!p->uartclk)
        return dev_err_probe(dev, -EINVAL, "clock rate not defined\n");
```
>
>         INIT_WORK(&data->clk_work, dw8250_clk_work_cb);
>         data->clk_notifier.notifier_call = dw8250_clk_notifier_cb;
> --
> 2.43.0
>
>





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux