devicetree/fdt: fix fdt_get_reg_size() get wrong size

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
Bowen Wang 2024-07-17 20:13:12 +08:00 committed by Xiang Xiao
parent 323e2518d9
commit ba18f87a9e
1 changed files with 3 additions and 1 deletions

View File

@ -325,7 +325,9 @@ size_t fdt_get_reg_size(FAR const void *fdt, int offset)
reg = fdt_getprop(fdt, offset, "reg", NULL);
if (reg != NULL)
{
size = fdt_ld_by_cells(reg, fdt_get_parent_size_cells(fdt, offset));
size = fdt_ld_by_cells((FAR fdt32_t *)reg +
fdt_get_parent_address_cells(fdt, offset),
fdt_get_parent_size_cells(fdt, offset));
}
return size;