summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2016-09-16 08:43:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 13:57:16 +0200
commited99f90e6b2e30bea7e1cc55e8870054fb7410c1 (patch)
tree797cc3eb0153e895227e14a2ab5b7152e272d017
parentfd67d47d265b8e4aaae726caf5a5bb99f62b2215 (diff)
downloaddt-utils-ed99f90e6b2e30bea7e1cc55e8870054fb7410c1.tar.gz
dt-utils-ed99f90e6b2e30bea7e1cc55e8870054fb7410c1.tar.xz
state: fix finding the correct parent node
Looking for the parent node during fixup is broken. The path of the parent node is not correctly terminated ('0' vs '\0'). Also, the new state node should be added to the supplied device tree not the barebox device tree used by of_find_node_by_path(). Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--src/barebox-state/state.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
index d07f522..a993088 100644
--- a/src/barebox-state/state.c
+++ b/src/barebox-state/state.c
@@ -306,8 +306,8 @@ static int of_state_fixup(struct device_node *root, void *ctx)
c = strrchr(of_path, '/');
if (!c)
return -ENODEV;
- *c = '0';
- parent = of_find_node_by_path(of_path);
+ *c = '\0';
+ parent = of_find_node_by_path_from(root, of_path);
if (!parent)
parent = root;