path: root/common
diff options
authorSascha Hauer <>2021-06-24 10:52:07 +0200
committerSascha Hauer <>2021-06-25 09:27:06 +0200
commit3b93bcd8db01bbe49249b59b0581b3ba375cb96b (patch)
tree0604686e2c408235c95c72114395af7911353dbe /common
parente5552d56b569939739c72319f5e10e439fb23cc0 (diff)
of: Add function to duplicate a device tree
This adds of_dup() to duplicate a device tree. Previously of_copy_node() was used for this, but of_copy_node() has issues with potentially duplicated phandle values when the new tree is inserted to an existing tree, that is when the parent argument of of_copy_node() is non NULL. All users of of_copy_node() with a NULL parent argument are converted to of_dup() which is safe to use leaving only the problematic users of of_copy_node(). Signed-off-by: Sascha Hauer <> Link: Signed-off-by: Sascha Hauer <>
Diffstat (limited to 'common')
1 files changed, 1 insertions, 1 deletions
diff --git a/common/oftree.c b/common/oftree.c
index 5eaa63ad7e..da8043809b 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -353,7 +353,7 @@ struct fdt_header *of_get_fixed_tree(struct device_node *node)
if (!node)
return NULL;
- freenp = node = of_copy_node(NULL, node);
+ freenp = node = of_dup(node);
if (!node)
return NULL;