aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--checks.c5
-rwxr-xr-xtests/run_tests.sh4
-rw-r--r--tests/unit-addr-simple-bus-compatible.dts18
-rw-r--r--tests/unit-addr-simple-bus-reg-mismatch.dts18
4 files changed, 43 insertions, 2 deletions
diff --git a/checks.c b/checks.c
index 9c9b0c3..1c398d5 100644
--- a/checks.c
+++ b/checks.c
@@ -910,7 +910,7 @@ static bool node_is_compatible(struct node *node, const char *compat)
for (str = prop->val.val, end = str + prop->val.len; str < end;
str += strnlen(str, end - str) + 1) {
- if (strprefixeq(str, end - str, compat))
+ if (streq(str, compat))
return true;
}
return false;
@@ -921,7 +921,8 @@ static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct
if (node_is_compatible(node, "simple-bus"))
node->bus = &simple_bus;
}
-WARNING(simple_bus_bridge, check_simple_bus_bridge, NULL, &addr_size_cells);
+WARNING(simple_bus_bridge, check_simple_bus_bridge, NULL,
+ &addr_size_cells, &compatible_is_string_list);
static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
{
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index adc4dae..6756f3d 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -668,6 +668,10 @@ dtc_tests () {
check_tests pci-bridge-bad1.dts pci_bridge
check_tests pci-bridge-bad2.dts pci_bridge
+ check_tests unit-addr-simple-bus-reg-mismatch.dts simple_bus_reg
+ check_tests unit-addr-simple-bus-compatible.dts simple_bus_reg
+
+
# Check warning options
run_sh_test dtc-checkfails.sh address_cells_is_cell interrupt_cells_is_cell -n size_cells_is_cell -- -Wno_size_cells_is_cell -I dts -O dtb bad-ncells.dts
run_sh_test dtc-fails.sh -n test-warn-output.test.dtb -I dts -O dtb bad-ncells.dts
diff --git a/tests/unit-addr-simple-bus-compatible.dts b/tests/unit-addr-simple-bus-compatible.dts
new file mode 100644
index 0000000..c8f9341
--- /dev/null
+++ b/tests/unit-addr-simple-bus-compatible.dts
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ bus@10000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "foo-bus", "simple-bus";
+ ranges = <0x0 0x10000000 0x10000>;
+
+ node@100 {
+ reg = <0x1000 1>;
+ };
+ };
+
+};
diff --git a/tests/unit-addr-simple-bus-reg-mismatch.dts b/tests/unit-addr-simple-bus-reg-mismatch.dts
new file mode 100644
index 0000000..2823377
--- /dev/null
+++ b/tests/unit-addr-simple-bus-reg-mismatch.dts
@@ -0,0 +1,18 @@
+/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>;
+ };
+ };
+
+};