[PATCH 2/2] dtc: libfdt: Introduce a can_assume check in fdt_check_full

Tom Rini trini at konsulko.com
Wed May 27 16:45:14 CEST 2026


On Wed, May 27, 2026 at 11:49:28AM +0200, Rasmus Villemoes wrote:
> On Tue, May 26 2026, Tom Rini <trini at konsulko.com> wrote:
> 
> > The current upstream method of having a function omit various tests is
> > to use the can_assume macro. Take the logic we had previously been using
> > and instead make it a can_assume(PERFECT) check within fdt_check_full
> > itself.
> >
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> > ---
> > I will be submitting this change upstream and will follow up if needed
> > here.
> > ---
> >  scripts/dtc/libfdt/fdt_check.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/scripts/dtc/libfdt/fdt_check.c b/scripts/dtc/libfdt/fdt_check.c
> > index a21ebbc9239f..7509c11d8580 100644
> > --- a/scripts/dtc/libfdt/fdt_check.c
> > +++ b/scripts/dtc/libfdt/fdt_check.c
> > @@ -21,6 +21,8 @@ int fdt_check_full(const void *fdt, size_t bufsize)
> >  	const char *propname;
> >  	bool expect_end = false;
> >  
> > +	if (can_assume(PERFECT))
> > +		return 0;
> 
> Is this right? I think that would require changing can_assume() to test
> if the given mask is a subset of FDT_ASSUME_MASK, not merely intersects
> it. When called with a single-bit mask, those are of course the same
> thing.
> 
> Because as-is, can_assume(PERFECT) is true if FDT_ASSUME_MASK has any
> non-zero value, but I don't think FDT_ASSUME_MASK=ASSUME_LATEST, for
> example, should imply "perfect".

Honestly (and I mentioned this to David in his reply on the
devicetree-compiler list) the usage of the mask today is either 0xff or
0x0 and nothing in between. Which means yes, I wonder a little about the
can_assume macro as opposed to how the mask was used originally.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260527/9c6f9c49/attachment.sig>


More information about the U-Boot mailing list