dgibson / dtc

Device Tree Compiler
219 stars 130 forks source link

libfdt: return correct value if #size-cells property is not present #20

Closed johnrclarke closed 5 years ago

johnrclarke commented 5 years ago

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.

dgibson commented 5 years ago

Oops, that's been wrong for a long time. At first I thought this might be a spec error, but looks like this has always been wrong, even for actual IEEE1275 systems.

The fix looks fine, however I'll need a Signed-off-by line from you in order to apply it (see https://git.eclipse.org/r/Documentation/user-signedoffby.html for example).

johnrclarke commented 5 years ago

Signed-off-by added. Thanks.