]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
boot/fit: read default-config property from the configurations node
authorAristo Chen <aristo.chen@canonical.com>
Fri, 8 May 2026 21:31:59 +0000 (21:31 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 25 May 2026 19:44:10 +0000 (13:44 -0600)
In fit_print_contents() the default configuration's unit name is read by
calling fdt_getprop() with noffset rather than confs_noffset. Today this
happens to work by coincidence: the preceding loop walks /images using
fdt_next_node(), and when iteration leaves the subtree libfdt returns
the offset of the next sibling in DFS order, which by FIT layout
convention is /configurations. The depth counter then drops below zero
and the loop exits with noffset still pointing at /configurations.

This relies on /images and /configurations being adjacent siblings and
on the implementation detail of fdt_next_node()'s post-exhaustion
return value. It also blocks a follow-up conversion to
fdt_for_each_subnode(), whose post-loop loop variable is a negative
error code rather than a valid offset.

Use confs_noffset directly, which the comment immediately above the
call already names as the source.

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
boot/image-fit.c

index 2d2709aa5b16fdc9a474243e000bbefe5e38d0f4..5a502e931061f10e95d3235c33a168ac251620db 100644 (file)
@@ -449,7 +449,7 @@ void fit_print_contents(const void *fit)
        }
 
        /* get default configuration unit name from default property */
-       uname = (char *)fdt_getprop(fit, noffset, FIT_DEFAULT_PROP, NULL);
+       uname = (char *)fdt_getprop(fit, confs_noffset, FIT_DEFAULT_PROP, NULL);
        if (uname)
                printf("%s Default Configuration: '%s'\n", p, uname);