[PATCH] clk: fixed_rate: Avoid calling dev_read_*() if CONFIG_OF_PLATDATA=y

Simon Glass sjg at chromium.org
Fri Nov 21 20:09:31 CET 2025


Hi Marek,

On Fri, 21 Nov 2025 at 10:53, Marek Vasut <marek.vasut at mailbox.org> wrote:
>
> On 11/21/25 6:35 PM, Simon Glass wrote:
>
> Hello Simon,
>
> >> To be made to clk_fixed_rate_ofdata_to_plat_(...) in
> >> drivers/clk/clk_fixed_rate.c as it does not currently call
> >> dev_has_ofnode(dev).
> >
> > Ah OK. So the call stack is something like:
> >
> > dev_read_u32_default()
> > dev_ofnode() - returns ofnode_null
> > ofnode_read_u32_default()
> > ofnode_read_u32_index
> > fdt_getprop(NULL, -1, ...)   // guess
> >
> > And I see that I put assert() in some of the ofnode_read..() functions
> > because I don't have tests for passing an invalid ofnode.
> >
> > So perhaps fdt_offset_ptr_() should check for NULL and return? I
> > haven't traced it though.
>
> In previous patch
>
> [PATCH 3/3] libfdt: Check fdt_offset_ptr() return value unconditionally
>
> that approach seems to have been rejected, and these dev_read_*() fixes
> were implemented as a replacement.

I don't think it was rejected...but I think the commit message should
better explain the problem, e.g. using some of the info above.

The only choice is whether to add the check unconditionally (which I
think is fine for now) or to add a new type of assumption.

Regards,
Simon


More information about the U-Boot mailing list