From 14dd76b96732ee7ffd1c42b1ff5922ccca902503 Mon Sep 17 00:00:00 2001 From: Herve Codina Date: Mon, 12 Jan 2026 15:18:55 +0100 Subject: [PATCH] fdtdump: Change FDT_PROP prob handling to ease future addition In order to ease future tags addition, perform operation related to FDT_PROP when the tag is explicitly FDT_PROP instead of relying to a kind of default value case. Handle the FDT_PROP tag exactly in the same way as it is done for other tags. No functional modification. Signed-off-by: Herve Codina Message-ID: <20260112142009.1006236-6-herve.codina@bootlin.com> Reviewed-by: Ayush Singh Signed-off-by: David Gibson --- fdtdump.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/fdtdump.c b/fdtdump.c index d424869..0260609 100644 --- a/fdtdump.c +++ b/fdtdump.c @@ -129,23 +129,25 @@ static void dump_blob(void *blob, bool debug) continue; } - if (tag != FDT_PROP) { - fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag); - break; + if (tag == FDT_PROP) { + sz = fdt32_to_cpu(GET_CELL(p)); + s = p_strings + fdt32_to_cpu(GET_CELL(p)); + if (version < 16 && sz >= 8) + p = PALIGN(p, 8); + t = p; + + p = PALIGN(p + sz, 4); + + dumpf("%04"PRIxPTR": string: %s\n", (uintptr_t)s - blob_off, s); + dumpf("%04"PRIxPTR": value\n", (uintptr_t)t - blob_off); + printf("%*s%s", depth * shift, "", s); + utilfdt_print_data(t, sz); + printf(";\n"); + continue; } - sz = fdt32_to_cpu(GET_CELL(p)); - s = p_strings + fdt32_to_cpu(GET_CELL(p)); - if (version < 16 && sz >= 8) - p = PALIGN(p, 8); - t = p; - p = PALIGN(p + sz, 4); - - dumpf("%04"PRIxPTR": string: %s\n", (uintptr_t)s - blob_off, s); - dumpf("%04"PRIxPTR": value\n", (uintptr_t)t - blob_off); - printf("%*s%s", depth * shift, "", s); - utilfdt_print_data(t, sz); - printf(";\n"); + fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag); + break; } }