Commit da2d4880 authored by Wende Tan's avatar Wende Tan Committed by Palmer Dabbelt

RISC-V: Fix memblock_free() usages in init_resources()

`memblock_free()` takes a physical address as its first argument.
Fix the wrong usages in `init_resources()`.

Fixes: ffe0e526 ("RISC-V: Improve init_resources()")
Fixes: 797f0375 ("RISC-V: Do not allocate memblock while iterating reserved memblocks")
Signed-off-by: default avatarWende Tan <twd2.me@gmail.com>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent b75db25c
...@@ -231,13 +231,13 @@ static void __init init_resources(void) ...@@ -231,13 +231,13 @@ static void __init init_resources(void)
/* Clean-up any unused pre-allocated resources */ /* Clean-up any unused pre-allocated resources */
mem_res_sz = (num_resources - res_idx + 1) * sizeof(*mem_res); mem_res_sz = (num_resources - res_idx + 1) * sizeof(*mem_res);
memblock_free((phys_addr_t) mem_res, mem_res_sz); memblock_free(__pa(mem_res), mem_res_sz);
return; return;
error: error:
/* Better an empty resource tree than an inconsistent one */ /* Better an empty resource tree than an inconsistent one */
release_child_resources(&iomem_resource); release_child_resources(&iomem_resource);
memblock_free((phys_addr_t) mem_res, mem_res_sz); memblock_free(__pa(mem_res), mem_res_sz);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment