[U-Boot] [PATCH 1/3] fix: fdtdec: allow parse 'reg' property with zero value in '#size-cells'
Przemyslaw Marczak
p.marczak at samsung.com
Thu Sep 24 17:29:48 CEST 2015
After rework of lib/fdtdec.c by commit:
commit 02464e386bb5f0a022c121f95ae75cf583759d95
Author: Stephen Warren <swarren at nvidia.com>
Date: Thu Aug 6 15:31:02 2015 -0600
the function fdtdec_get_addr() doesn't work as previous,
because the implementation assumes that properties '#address-cells'
and '#size-cells' are equal to 1, which can be not true sometimes.
The new API introduced fdtdec_get_addr_size_auto_parent() for the 'reg'
property parsing, but the implementation assumes, that #size-cells
can't be less than 1.
This causes that the following children's 'reg' property can't be reached:
parent at 0x0 {
#address-cells = <1>;
#size-cells = <0>;
children at 0x100 {
reg = < 0x100 >;
};
};
Change the condition value from '1' to '0', which allows parsing property
with at least zero #size-cells, fixes the issue.
Now, fdtdec_get_addr_size_auto_parent() works properly.
Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
---
lib/fdtdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 9f0b65d..9cf57b9 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;
}
--
1.9.1
More information about the U-Boot
mailing list