riscv/mm: Use BUG_ON instead of if condition followed by BUG.

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>
This commit is contained in:
zhouchuangao 2021-03-30 06:56:26 -07:00 committed by Palmer Dabbelt
parent b1ebaa0e13
commit e75e6bf47a
No known key found for this signature in database
GPG Key ID: 2E1319F35FBB1889

View File

@ -232,8 +232,8 @@ static phys_addr_t alloc_pte_late(uintptr_t va)
unsigned long vaddr; unsigned long vaddr;
vaddr = __get_free_page(GFP_KERNEL); vaddr = __get_free_page(GFP_KERNEL);
if (!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))) BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)));
BUG();
return __pa(vaddr); return __pa(vaddr);
} }