mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Assumption stated in the comments as if fdt_for_each_subnode() checks for parent < 0 is utterly wrong. If parent is < 0, node offset is set to 0 (i.e. the very first node in the tree) and the loop's body is executed. This incorrect assumption causes overlay_node_count() to also count nodes that do not have __overlay__ as their subnode. The same story goes for overlay_get_nodes_info(), where we end up requiring each node directly under root node to have "target-path" set. DTBOs can specify other nodes including special ones like __symbols__, __fixups__ that can be left to reduce the number of steps a user needs to do to when it comes to invalid phandles. Fix it by adding checks if overlay < 0 after respective calls to fdt_subnode_offset(). Signed-off-by: Michal Orzel <michal.orzel@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>