Skip to content

Commit e75e6bf

Browse files
zhouchuangaopalmer-dabbelt
authored andcommitted
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 <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent b1ebaa0 commit e75e6bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/riscv/mm/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ static phys_addr_t alloc_pte_late(uintptr_t va)
232232
unsigned long vaddr;
233233

234234
vaddr = __get_free_page(GFP_KERNEL);
235-
if (!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)))
236-
BUG();
235+
BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr)));
236+
237237
return __pa(vaddr);
238238
}
239239

0 commit comments

Comments
 (0)