summaryrefslogtreecommitdiff
path: root/libfdt/fdt_ro.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-11-01 16:05:51 +0100
committerWolfgang Denk <wd@denx.de>2008-11-01 16:05:51 +0100
commit17380cb04d510ad1a6983e6d448d2520d444b66a (patch)
treead9375511bb8662d9d6acea24f1d09e9010c350a /libfdt/fdt_ro.c
parent4cc64742a89e8ce90c69c3c85e4e9f4706062f2f (diff)
parent4bc7deee9095f21e243b724ca3d634251c1d5432 (diff)
downloadu-boot-imx-17380cb04d510ad1a6983e6d448d2520d444b66a.zip
u-boot-imx-17380cb04d510ad1a6983e6d448d2520d444b66a.tar.gz
u-boot-imx-17380cb04d510ad1a6983e6d448d2520d444b66a.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-fdt
Diffstat (limited to 'libfdt/fdt_ro.c')
-rw-r--r--libfdt/fdt_ro.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index b705f91..fdc9c29 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -112,12 +112,12 @@ int fdt_num_mem_rsv(const void *fdt)
int fdt_subnode_offset_namelen(const void *fdt, int offset,
const char *name, int namelen)
{
- int depth;
+ int depth = 0;
FDT_CHECK_HEADER(fdt);
- for (depth = 0;
- offset >= 0;
+ for (depth = 0, offset = fdt_next_node(fdt, offset, &depth);
+ (offset >= 0) && (depth > 0);
offset = fdt_next_node(fdt, offset, &depth)) {
if (depth < 0)
return -FDT_ERR_NOTFOUND;
@@ -126,7 +126,10 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset,
return offset;
}
- return offset; /* error */
+ if (offset < 0)
+ return offset; /* error */
+ else
+ return -FDT_ERR_NOTFOUND;
}
int fdt_subnode_offset(const void *fdt, int parentoffset,