[RFC PATCH v2 47/74] dtc: Handle orphan nodes in complete_references()
From: Herve Codina
Date: Wed Aug 26 2026 - 06:20:42 EST
Orphan nodes have been introduced recently.
Completing references involving orphan nodes is needed just like for the
'root' node.
Also, it is worth noting that even if an orphan node can be referenced,
this orphan node is an external node and so the references pointing
to orphan nodes cannot be a local reference.
Update related functions to handle orphan nodes.
Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
---
livetree.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/livetree.c b/livetree.c
index 8f0aa868..71712649 100644
--- a/livetree.c
+++ b/livetree.c
@@ -584,11 +584,15 @@ static void complete_ref_and_is_local(struct dt_info *dti, char **ref,
* phandle value is available) but not the reference.
*
* Complete both ref and is_local based on existing values.
+ *
+ * Also take care of references pointing to an orphan node. Those
+ * reference are not local references. Indeed, an orphan node is an
+ * external node.
*/
if (*ref) {
refnode = get_node_by_ref(dti, *ref);
- if (refnode)
+ if (refnode && !node_is_orphan(dti, refnode))
*is_local = true;
else
*is_local = false;
@@ -655,7 +659,12 @@ static void complete_references_internal(struct dt_info *dti, struct node *node)
static void complete_references(struct dt_info *dti)
{
+ struct node *orphan;
+
complete_references_internal(dti, dti->dt);
+
+ for_each_orphan(dti->orphanlist, orphan)
+ complete_references_internal(dti, orphan);
}
struct dt_info *build_dt_info(unsigned int dtsflags,
--
2.55.0