aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-12-09 15:50:53 -0600
committerDavid Gibson <david@gibson.dropbear.id.au>2025-12-10 17:47:45 +1100
commit194ac9422ac956e7b1f0dd43649a169bbbf86c58 (patch)
treeba9d37774edaaaa30e0402d2f37aa01b300c1b4a
parent39cae0bd0031e31a7b027cefbfb0bf7ff1201b52 (diff)
downloaddtc-master.zip
dtc-master.tar.gz
dtc-master.tar.bz2
libfdt: fdt_get_name: Add can_assume(VALID_DTB) checkHEADmastermain
In this function from fdt_ro.c we have (reasonably) some checks of the DTB before we begin work. However, we do this in a way that we cannot make use of the normal FDT_RO_PROBE macro and instead have a direct call to fdt_ro_probe_(). Add a test for !can_assume(VALID_DTB) here first so that in cases where we are assuming a valid DTB we can omit the checks. Signed-off-by: Tom Rini <trini@konsulko.com> Message-ID: <20251210022002.3004223-4-trini@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--libfdt/fdt_ro.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index b78c4e4..63494fb 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -306,8 +306,8 @@ const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
const char *nameptr;
int err;
- if (((err = fdt_ro_probe_(fdt)) < 0)
- || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))
+ if (!can_assume(VALID_DTB) && (((err = fdt_ro_probe_(fdt)) < 0)
+ || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)))
goto fail;
nameptr = nh->name;