For nomap case, the memory block will be removed by memblock_remove() in early_init_dt_alloc_reserved_memory_arch(). So it's meaningless to call memblock_free() on error path. Cc: Rob Herring <robh+dt@xxxxxxxxxx> Cc: devicetree@xxxxxxxxxxxxxxx Signed-off-by: Dong Aisheng <aisheng.dong@xxxxxxx> --- drivers/of/of_reserved_mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 4592b71aba5c..367f298a83b2 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -275,9 +275,10 @@ void __init fdt_init_reserved_mem(void) if (err != 0 && err != -ENOENT) { pr_info("node %s compatible matching fail\n", rmem->name); - memblock_free(rmem->base, rmem->size); if (nomap) memblock_add(rmem->base, rmem->size); + else + memblock_free(rmem->base, rmem->size); } } } -- 2.25.1