aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Clarke <johnc@kirriwa.net>2018-11-02 12:46:22 +1100
committerJohn Clarke <johnc@kirriwa.net>2018-11-07 14:13:12 +1100
commitaa7254d9cb173b43714013eef3769475948956f9 (patch)
treec2f76557751c5216acd1da7882455d06e7ea85b2 /tests
parentda2b691ccf6863b2f5039d98e71f09d4244e5aa1 (diff)
downloaddtc-aa7254d9cb173b43714013eef3769475948956f9.zip
dtc-aa7254d9cb173b43714013eef3769475948956f9.tar.gz
dtc-aa7254d9cb173b43714013eef3769475948956f9.tar.bz2
libfdt: return correct value if #size-cells property is not present
According to the device tree specification, the default value for #size-cells is 1, but fdt_size_cells() was returning 2 if this property was not present. This patch also makes fdt_address_cells() and fdt_size_cells() conform to the behaviour documented in libfdt.h. The defaults are only returned if fdt_getprop() returns -FDT_ERR_NOTFOUND, otherwise the actual error is returned. Signed-off-by: John Clarke <johnc@kirriwa.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/addr_size_cells.c2
-rw-r--r--tests/addr_size_cells2.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/addr_size_cells.c b/tests/addr_size_cells.c
index fcd9ff0..1b196ef 100644
--- a/tests/addr_size_cells.c
+++ b/tests/addr_size_cells.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
fdt = load_blob(argv[1]);
check_node(fdt, "/", 2, 2);
- check_node(fdt, "/identity-bus@0", 2, 2);
+ check_node(fdt, "/identity-bus@0", 2, 1);
check_node(fdt, "/simple-bus@1000000", 2, 1);
check_node(fdt, "/c0", -FDT_ERR_BADNCELLS, -FDT_ERR_BADNCELLS);
check_node(fdt, "/c1", -FDT_ERR_BADNCELLS, -FDT_ERR_BADNCELLS);
diff --git a/tests/addr_size_cells2.c b/tests/addr_size_cells2.c
index 38b2c04..52c4eba 100644
--- a/tests/addr_size_cells2.c
+++ b/tests/addr_size_cells2.c
@@ -57,6 +57,6 @@ int main(int argc, char *argv[])
test_init(argc, argv);
fdt = load_blob(argv[1]);
- check_node(fdt, "/", 2, 2);
+ check_node(fdt, "/", 2, 1);
PASS();
}