aboutsummaryrefslogtreecommitdiff
path: root/flattree.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-09-04 10:43:03 +1000
committerJon Loeliger <jdl@freescale.com>2007-09-05 13:17:14 -0500
commit592ea5888c27b154e6dc4b9b3ed98978369271c8 (patch)
tree99d1df4c0b83803514393141bbdedafdc244bbaa /flattree.c
parentbf944970317820867895680cf0e2c4e72eefa8b1 (diff)
downloaddtc-592ea5888c27b154e6dc4b9b3ed98978369271c8.zip
dtc-592ea5888c27b154e6dc4b9b3ed98978369271c8.tar.gz
dtc-592ea5888c27b154e6dc4b9b3ed98978369271c8.tar.bz2
dtc: Assume properties preced subnodes in the flattened tree
With kernel commit eff2ebd207af9f501af0ef667a7d14befcb36c1b, we clarified that in the flattened tree format, a particular nodes properties are required to precede its subdnodes. At present however, both dtc and libfdt will process trees which don't meet this condition. This patch simplifies the code for fdt_get_property() based on assuming that constraint. dtc continues to be able to handle such an invalid tree - on the grounds that it's useful for dtc to be able to correct such a broken tree - but this patch adds a warning when this condition is not met while reading a flattened tree. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'flattree.c')
-rw-r--r--flattree.c3
1 files changed, 3 insertions, 0 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;