[PATCH] clk: Fix return value of of_clk_get_by_name()

Alexander Shiyan eagle.alexander923 at gmail.com
Fri Oct 6 03:00:05 PDT 2023


> On 06.10.23 07:28, Alexander Shiyan wrote:
> > of_clk_get_by_name() is used by clk_bulk_get_optional() => clk_get() function,
> > so in case some clocks are missing we should return -ENOENT error code,
> > as this is normal for optional clocks.
> > The current implementation of of_clk_get_by_name() returns the -EINVAL error
> > that comes from of_clk_get() with index <0 if the clock is not described
> > in the device tree.
>
> I stumbled upon the same problem and found that of_clk_get_by_name() returning
> ERR_PTR(-EINVAL) in this case is documented Linux behavior (for of_parse_clkspec()).
>
> The correct solution is thus to leave of_clk_get_by_name() alone and align
> clk_get return values with Linux.
>
> I did this in
> https://lore.barebox.org/barebox/20230921080236.GX637806@pengutronix.de/T/#t
>
> Can you test with that and see if it solves your issue?

Hello Ahmad.
Yes, this patch works. Thanks!



More information about the barebox mailing list