All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libfdt: fdt_check_full: Add can_assume(PERFECT) check
@ 2026-05-26 20:30 Tom Rini
  2026-05-27  4:23 ` David Gibson
  2026-05-27  4:41 ` Simon Glass
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Rini @ 2026-05-26 20:30 UTC (permalink / raw)
  To: devicetree-compiler

In this function from fdt_check.c we have (reasonably and as the name
implies) a number of checks on the DTB. However, there are cases where
we may wish to assume that we have been given a perfect DTB already and
do nothing here. Add a test for can_assume(PERFECT) as the first check
in this function and if true, perform no checks.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
Along the lines of the patches I posted back in December, in U-Boot SPL
we just don't have the space for this check much of the time and so have
always omitted it (going back to at least when Simon posted the initial
patch to make libfdt/fdt_check.c here). This is another case where it's
a noticeable size win for us. I had missed this change in particular
because we had in turn missed catching up on fdt_check_full being moved
out of fdt_ro.c and in to fdt_check.c.
---
 libfdt/fdt_check.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libfdt/fdt_check.c b/libfdt/fdt_check.c
index cca052353213..2fd5b61d016a 100644
--- a/libfdt/fdt_check.c
+++ b/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;
 	if (bufsize < FDT_V1_SIZE)
 		return -FDT_ERR_TRUNCATED;
 	if (bufsize < fdt_header_size(fdt))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-05 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 20:30 [PATCH] libfdt: fdt_check_full: Add can_assume(PERFECT) check Tom Rini
2026-05-27  4:23 ` David Gibson
2026-05-27  4:38   ` Tom Rini
2026-06-05 22:20     ` Tom Rini
2026-05-27  4:41 ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.