diff mbox series

[1/2] of: of_reserved_mem: only call memblock_free for normal reserved memory

Message ID 20210611131153.3731147-1-aisheng.dong@nxp.com (mailing list archive)
State New, archived
Headers show
Series [1/2] of: of_reserved_mem: only call memblock_free for normal reserved memory | expand

Commit Message

Aisheng Dong June 11, 2021, 1:11 p.m. UTC
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@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/of/of_reserved_mem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Rob Herring (Arm) June 24, 2021, 7:05 p.m. UTC | #1
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 <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> ---
>  drivers/of/of_reserved_mem.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Applied, thanks!
diff mbox series

Patch

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);
 			}
 		}
 	}