platform_external_dtc/tests/unit-addr-simple-bus-reg-mismatch.dts
Rob Herring e84742aa7b checks: fix simple-bus compatible matching
Since commit 7975f64222 ("Fix widespread incorrect use of strneq(),
replace with new strprefixeq()") simple-bus checks have been silently
skipped. The problem was 'end - str' is one more than the string length
and the strnlen in strprefixeq fails. This can't be fixed simply by
subtracting one as it is possible to have multiple '\0' at the end of
the property. Fix this by making the 'compatible' property string list
check a dependency, and then we can assume the property is null
terminated and we can just use streq() for comparisons.

Add some tests so the problem doesn't happen again.

Fixes: 7975f64222 ("Fix widespread incorrect use of strneq(), replace with new strprefixeq()")
Reported-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-21 11:31:16 +10:00

18 lines
234 B
Text

/dts-v1/;
/ {
#address-cells = <1>;
#size-cells = <1>;
bus@10000000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
ranges = <0x0 0x10000000 0x10000>;
node@100 {
reg = <0x1000 1>;
};
};
};