summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-06-24 10:52:07 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-25 09:27:06 +0200
commit3b93bcd8db01bbe49249b59b0581b3ba375cb96b (patch)
tree0604686e2c408235c95c72114395af7911353dbe /commands
parente5552d56b569939739c72319f5e10e439fb23cc0 (diff)
downloadbarebox-3b93bcd8db01bbe49249b59b0581b3ba375cb96b.tar.gz
barebox-3b93bcd8db01bbe49249b59b0581b3ba375cb96b.tar.xz
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 <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/of_diff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/commands/of_diff.c b/commands/of_diff.c
index ec039776cf..d9d84fd4bf 100644
--- a/commands/of_diff.c
+++ b/commands/of_diff.c
@@ -25,7 +25,7 @@ static struct device_node *get_tree(const char *filename, struct device_node *ro
if (!node)
return ERR_PTR(-ENOENT);
- return of_copy_node(NULL, node);
+ return of_dup(node);
}
if (!strcmp(filename, "+")) {
@@ -33,7 +33,7 @@ static struct device_node *get_tree(const char *filename, struct device_node *ro
if (!node)
return ERR_PTR(-ENOENT);
- node = of_copy_node(NULL, root);
+ node = of_dup(root);
of_fix_tree(node);