|
@@ -112,24 +112,20 @@ 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 = 0;
|
|
|
+ int depth;
|
|
|
|
|
|
FDT_CHECK_HEADER(fdt);
|
|
|
|
|
|
- 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;
|
|
|
- else if ((depth == 1)
|
|
|
- && _fdt_nodename_eq(fdt, offset, name, namelen))
|
|
|
+ for (depth = 0;
|
|
|
+ (offset >= 0) && (depth >= 0);
|
|
|
+ offset = fdt_next_node(fdt, offset, &depth))
|
|
|
+ if ((depth == 1)
|
|
|
+ && _fdt_nodename_eq(fdt, offset, name, namelen))
|
|
|
return offset;
|
|
|
- }
|
|
|
|
|
|
- if (offset < 0)
|
|
|
- return offset; /* error */
|
|
|
- else
|
|
|
+ if (depth < 0)
|
|
|
return -FDT_ERR_NOTFOUND;
|
|
|
+ return offset; /* error */
|
|
|
}
|
|
|
|
|
|
int fdt_subnode_offset(const void *fdt, int parentoffset,
|