[PATCH] libfdt: fdt_check_full: Add can_assume(PERFECT) check
Tom Rini <[email protected]> Tue, 26 May 2026 14:30:22 -0600
| Newsgroups | org.kernel.vger.devicetree-compiler |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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