summaryrefslogtreecommitdiff
path: root/libfdt
diff options
context:
space:
mode:
authorGerald Van Baren <vanbaren@cideas.com>2007-05-21 23:27:16 -0400
committerGerald Van Baren <vanbaren@cideas.com>2007-08-10 19:21:36 -0400
commit06e19a07701c968f15d72c083b5872a1a11c7b01 (patch)
treee2a263a8a1e2002fc0353fa446f4aee746e43cf0 /libfdt
parent9675ee7208ab965d13ea8d8262d77ac4160ef549 (diff)
For fdt_find_node_by_path(), handle the root path properly.
Also removes the special case root path detection in cmd_fdt.c since it is no longer necessary. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
Diffstat (limited to 'libfdt')
-rw-r--r--libfdt/fdt_ro.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index 923c389ece9..ffd9209b193 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -283,6 +283,10 @@ int fdt_find_node_by_path(const void *fdt, const char *path)
if (*path != '/')
return -FDT_ERR_BADPATH;
+ /* Handle the root path: root offset is 0 */
+ if (strcmp(path, "/") == 0)
+ return 0;
+
while (*p) {
const char *q;