diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/boot/libfdt/fdt_ro.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/powerpc/boot/libfdt/fdt_ro.c b/arch/powerpc/boot/libfdt/fdt_ro.c index 129b532bcc1a..fbbba44fcd0d 100644 --- a/arch/powerpc/boot/libfdt/fdt_ro.c +++ b/arch/powerpc/boot/libfdt/fdt_ro.c | |||
@@ -104,8 +104,8 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset, | |||
104 | 104 | ||
105 | FDT_CHECK_HEADER(fdt); | 105 | FDT_CHECK_HEADER(fdt); |
106 | 106 | ||
107 | for (depth = 0; | 107 | for (depth = 0, offset = fdt_next_node(fdt, offset, &depth); |
108 | offset >= 0; | 108 | (offset >= 0) && (depth > 0); |
109 | offset = fdt_next_node(fdt, offset, &depth)) { | 109 | offset = fdt_next_node(fdt, offset, &depth)) { |
110 | if (depth < 0) | 110 | if (depth < 0) |
111 | return -FDT_ERR_NOTFOUND; | 111 | return -FDT_ERR_NOTFOUND; |
@@ -114,7 +114,10 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset, | |||
114 | return offset; | 114 | return offset; |
115 | } | 115 | } |
116 | 116 | ||
117 | return offset; /* error */ | 117 | if (offset < 0) |
118 | return offset; /* error */ | ||
119 | else | ||
120 | return -FDT_ERR_NOTFOUND; | ||
118 | } | 121 | } |
119 | 122 | ||
120 | int fdt_subnode_offset(const void *fdt, int parentoffset, | 123 | int fdt_subnode_offset(const void *fdt, int parentoffset, |