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>2016-09-20 10:28:53 +0200
commit8c6ca8acc581fee5db9482985d291b4d5a6b67f7 (patch)
tree12dfbc7bbba8d716e593f4d30225335b5b095df8
parentba5e1708cdfca9b89ee42ab3372ffdf8ae60f1ab (diff)
downloadbarebox-8c6ca8acc581fee5db9482985d291b4d5a6b67f7.tar.gz
barebox-8c6ca8acc581fee5db9482985d291b4d5a6b67f7.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--common/state/state.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/state/state.c b/common/state/state.c
index 0c329cd675..075618e5bb 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -307,8 +307,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;