Skip to content

Commit

Permalink
riscv/mm: Use BUG_ON instead of if condition followed by BUG.
Browse files Browse the repository at this point in the history
BUG_ON() uses unlikely in if(), which can be optimized at compile time.

Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
  • Loading branch information
zhouchuangao authored and Palmer Dabbelt committed Apr 26, 2021
1 parent b1ebaa0 commit e75e6bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/riscv/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ static phys_addr_t alloc_pte_late(uintptr_t va)
unsigned long vaddr;

vaddr = __get_free_page(GFP_KERNEL);
if (!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)))
BUG();
BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)));

return __pa(vaddr);
}

Expand Down

0 comments on commit e75e6bf

Please sign in to comment.