aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flattree.c3
-rw-r--r--libfdt/fdt_ro.c14
2 files changed, 5 insertions, 12 deletions
diff --git a/flattree.c b/flattree.c
index e857b08..d7dc6b0 100644
--- a/flattree.c
+++ b/flattree.c
@@ -779,6 +779,9 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
val = flat_read_word(dtbuf);
switch (val) {
case OF_DT_PROP:
+ if (node->children)
+ fprintf(stderr, "Warning: Flat tree input has "
+ "subnodes preceding a property.\n");
prop = flat_read_property(dtbuf, strbuf, flags);
add_property(node, prop);
break;
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index 65bd1a2..6e4d3c8 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -197,7 +197,6 @@ const struct fdt_property *fdt_get_property(const void *fdt,
int nodeoffset,
const char *name, int *lenp)
{
- int level = 0;
uint32_t tag;
const struct fdt_property *prop;
int namestroff;
@@ -225,17 +224,11 @@ const struct fdt_property *fdt_get_property(const void *fdt,
goto fail;
case FDT_BEGIN_NODE:
- level++;
- break;
-
case FDT_END_NODE:
- level--;
+ case FDT_NOP:
break;
case FDT_PROP:
- if (level != 0)
- continue;
-
err = -FDT_ERR_BADSTRUCTURE;
prop = fdt_offset_ptr_typed(fdt, offset, prop);
if (! prop)
@@ -256,14 +249,11 @@ const struct fdt_property *fdt_get_property(const void *fdt,
}
break;
- case FDT_NOP:
- break;
-
default:
err = -FDT_ERR_BADSTRUCTURE;
goto fail;
}
- } while (level >= 0);
+ } while ((tag != FDT_BEGIN_NODE) && (tag != FDT_END_NODE));
err = -FDT_ERR_NOTFOUND;
fail: