[PATCH 01/18] of: of_copy_node(): Copy phandles as well
Sascha Hauer
s.hauer at pengutronix.de
Thu Jun 24 01:52:06 PDT 2021
of_copy_node() has to copy the phandles as well, because otherwise
the phandles in the copied tree become invalid.
This is not entirely correct because when of_copy_node() is used to
copy one tree as a subtree of another tree then we might get duplicated
phandles which will result in a corrupted tree. This is also an issue
already without this patch, because the phandle of a node is not only
stored in the phandle member of a struct device_node, but also as a
separate phandle property in the tree itself. The phandle property is
copied before this patch, so we can equally well also copy the phandle
member of struct device_node.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/of/base.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 193bae7fa0..1434f39ad1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2409,6 +2409,7 @@ struct device_node *of_copy_node(struct device_node *parent, const struct device
struct property *pp;
np = of_new_node(parent, other->name);
+ np->phandle = other->phandle;
list_for_each_entry(pp, &other->properties, list)
of_new_property(np, pp->name, pp->value, pp->length);
--
2.29.2
More information about the barebox
mailing list