Handle in boot_fdt_reserve_region any return value > 0 of lmb_reserve() function; it occurs when coalesced region are found: adjacent reserved region are merged.
This patch avoid the error trace: ERROR: reserving fdt memory region failed.. when reserved region are merged (return value = 1). Signed-off-by: Patrick Delaunay <[email protected]> --- Tested on stm32mp1 board v2019.04-rc2 with reserved memory in device tree: reserved-memory { #address-cells = <1>; #size-cells = <1>; ranges; retram: retram@0x38000000 { compatible = "shared-dma-pool"; reg = <0x38000000 0x10000>; no-map; }; mcuram: mcuram@0x30000000 { compatible = "shared-dma-pool"; reg = <0x30000000 0x40000>; no-map; }; mcuram2: mcuram2@0x10000000 { compatible = "shared-dma-pool"; reg = <0x10000000 0x40000>; no-map; }; vdev0vring0: vdev0vring0@10040000 { compatible = "shared-dma-pool"; reg = <0x10040000 0x2000>; no-map; }; vdev0vring1: vdev0vring1@10042000 { compatible = "shared-dma-pool"; reg = <0x10042000 0x2000>; no-map; }; vdev0buffer: vdev0buffer@10044000 { compatible = "shared-dma-pool"; reg = <0x10044000 0x4000>; no-map; }; }; we have several adjacent reserved memory (0x10000000...0x10046000) Without the patch I have the ERROR: ERROR: reserving fdt memory region failed (addr=10040000 size=2000) ERROR: reserving fdt memory region failed (addr=10042000 size=2000) ERROR: reserving fdt memory region failed (addr=10044000 size=2000) lmb_dump_all: memory.cnt = 0x1 memory.size = 0x0 memory.reg[0x0].base = 0xc0000000 .size = 0x40000000 reserved.cnt = 0x4 reserved.size = 0x0 reserved.reg[0x0].base = 0x10000000 .size = 0x46000 reserved.reg[0x1].base = 0x30000000 .size = 0x40000 reserved.reg[0x2].base = 0x38000000 .size = 0x10000 reserved.reg[0x3].base = 0xfdc38a98 .size = 0x23c7568 with the patch not more issue... common/image-fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index 94089b2..01186ae 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -71,10 +71,10 @@ static const image_header_t *image_get_fdt(ulong fdt_addr) static void boot_fdt_reserve_region(struct lmb *lmb, uint64_t addr, uint64_t size) { - int ret; + long ret; ret = lmb_reserve(lmb, addr, size); - if (!ret) { + if (ret >= 0) { debug(" reserving fdt memory region: addr=%llx size=%llx\n", (unsigned long long)addr, (unsigned long long)size); } else { -- 2.7.4 _______________________________________________ U-Boot mailing list [email protected] https://lists.denx.de/listinfo/u-boot

