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>
This commit is contained in:
John Clarke 2018-11-02 12:46:22 +11:00
parent da2b691ccf
commit aa7254d9cb
4 changed files with 16 additions and 6 deletions

View file

@ -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();
}