summaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 9f0b65d..1a86369 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -149,7 +149,7 @@ fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent,
}
ns = fdt_size_cells(blob, parent);
- if (ns < 1) {
+ if (ns < 0) {
debug("(bad #size-cells)\n");
return FDT_ADDR_T_NONE;
}
@@ -180,10 +180,11 @@ fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void *blob, int node,
fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
const char *prop_name, fdt_size_t *sizep)
{
+ int ns = sizep ? (sizeof(fdt_size_t) / sizeof(fdt32_t)) : 0;
+
return fdtdec_get_addr_size_fixed(blob, node, prop_name, 0,
sizeof(fdt_addr_t) / sizeof(fdt32_t),
- sizeof(fdt_size_t) / sizeof(fdt32_t),
- sizep);
+ ns, sizep);
}
fdt_addr_t fdtdec_get_addr(const void *blob, int node,