platform_external_dtc/tests/path-references.dts
Rob Herring 522d81d572 Fix dts output with a REF_PATH marker
Commit 8c59a97ce0 ("Fix missing labels when emitting dts format")
fixed label output, but broke output when there is a REF_PATH marker.

The problem is a REF_PATH marker causes a zero length string to be
emitted. The write_propval_string() function requires a length of at
least 1 (including the terminating '\0'), but that was not being
checked.

For the integer output, a length of 0 is valid as it is possible to have
labels inside the starting '<':

int-prop = < start: 0x1234>;

REF_PHANDLE is another marker that we don't explicitly handle, but it
doesn't cause a problem as it is fundamentally just an int.

Fixes: 8c59a97ce0 ("Fix missing labels when emitting dts format")
Reported-by: Kumar Gala <kumar.gala@linaro.org>
Cc: Grant Likely <grant.likely@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-27 10:58:35 +10:00

28 lines
461 B
Text

/dts-v1/;
/ {
rref = &{/};
/* Check multiple references case */
multiref = &n1 , &n2;
n1: node1 {
ref = &{/node2}; /* reference precedes target */
lref = &n2;
};
n2: node2 {
ref = &{/node1}; /* reference after target */
lref = &n1;
};
/* Check references to nested nodes with common prefix */
foobar {
n3: baz {
ref = &{/foo/baz};
lref = start: &n4 end:;
};
};
foo {
n4: baz {
ref = &{/foobar/baz};
lref = &n3;
};
};
};