Skip to content

Commit

Permalink
RISC-V: Fix memblock_free() usages in init_resources()
Browse files Browse the repository at this point in the history
`memblock_free()` takes a physical address as its first argument.
Fix the wrong usages in `init_resources()`.

Fixes: ffe0e52 ("RISC-V: Improve init_resources()")
Fixes: 797f037 ("RISC-V: Do not allocate memblock while iterating reserved memblocks")
Signed-off-by: Wende Tan <twd2.me@gmail.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
  • Loading branch information
Wende Tan authored and Palmer Dabbelt committed Jun 2, 2021
1 parent b75db25 commit da2d488
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/riscv/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ static void __init init_resources(void)

/* Clean-up any unused pre-allocated resources */
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;

error:
/* Better an empty resource tree than an inconsistent one */
release_child_resources(&iomem_resource);
memblock_free((phys_addr_t) mem_res, mem_res_sz);
memblock_free(__pa(mem_res), mem_res_sz);
}


Expand Down

0 comments on commit da2d488

Please sign in to comment.