2021-06-11 13:16:23

by Aisheng Dong

[permalink] [raw]
Subject: [PATCH 1/2] of: of_reserved_mem: only call memblock_free for normal reserved memory

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 <[email protected]>
Cc: [email protected]
Signed-off-by: Dong Aisheng <[email protected]>
---
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


2021-06-24 19:09:28

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/2] of: of_reserved_mem: only call memblock_free for normal reserved memory

On Fri, 11 Jun 2021 21:11:52 +0800, Dong Aisheng wrote:
> 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 <[email protected]>
> Cc: [email protected]
> Signed-off-by: Dong Aisheng <[email protected]>
> ---
> drivers/of/of_reserved_mem.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

Applied, thanks!