Only assign outputs if both address and size are found. Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> --- lib/devicetree.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/devicetree.c b/lib/devicetree.c index c091459a94e27..6ebd4ff5b2a9c 100644 --- a/lib/devicetree.c +++ b/lib/devicetree.c @@ -23,21 +23,24 @@ int dt_get_nr_cells(int fdtnode, u32 *nr_address_cells, u32 *nr_size_cells) { const struct fdt_property *prop; u32 *nr_cells; - int len; + int len, nac, nsc; prop = fdt_get_property(fdt, fdtnode, "#address-cells", &len); if (prop == NULL) return len; nr_cells = (u32 *)prop->data; - *nr_address_cells = fdt32_to_cpu(*nr_cells); + nac = fdt32_to_cpu(*nr_cells); prop = fdt_get_property(fdt, fdtnode, "#size-cells", &len); if (prop == NULL) return len; nr_cells = (u32 *)prop->data; - *nr_size_cells = fdt32_to_cpu(*nr_cells); + nsc = fdt32_to_cpu(*nr_cells); + + *nr_address_cells = nac; + *nr_size_cells = nsc; return 0; } -- 2.4.11 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html