aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/yamltree.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dtc/yamltree.c')
-rw-r--r--scripts/dtc/yamltree.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/dtc/yamltree.c b/scripts/dtc/yamltree.c
index 5b6ea8ea862f..43ca869dd6a8 100644
--- a/scripts/dtc/yamltree.c
+++ b/scripts/dtc/yamltree.c
@@ -138,6 +138,27 @@ static void yaml_propval(yaml_emitter_t *emitter, struct property *prop)
(yaml_char_t *)YAML_SEQ_TAG, 1, YAML_FLOW_SEQUENCE_STYLE);
yaml_emitter_emit_or_die(emitter, &event);
+ /* Ensure we have a type marker before any phandle */
+ for_each_marker(m) {
+ int last_offset = 0;
+ struct marker *type_m;
+
+ if (m->type >= TYPE_UINT8)
+ last_offset = m->offset;
+
+ if (!(m->next && m->next->type == REF_PHANDLE &&
+ last_offset < m->next->offset))
+ continue;
+
+ type_m = xmalloc(sizeof(*type_m));
+ type_m->offset = m->next->offset;
+ type_m->type = TYPE_UINT32;
+ type_m->ref = NULL;
+ type_m->next = m->next;
+ m->next = type_m;
+ }
+
+ m = prop->val.markers;
for_each_marker(m) {
int chunk_len;
char *data = &prop->val.val[m->offset];