summaryrefslogtreecommitdiffstats
path: root/arch/riscv
diff options
context:
space:
mode:
authorzhouchuangao <zhouchuangao@vivo.com>2021-03-30 15:56:26 +0200
committerPalmer Dabbelt <palmerdabbelt@google.com>2021-04-26 17:25:18 +0200
commite75e6bf47a4723ce16f65c7387c20a8c18a1c13b (patch)
treee65cc09e56b4ad55035e9d9b37639ffb84523873 /arch/riscv
parentriscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe (diff)
downloadlinux-e75e6bf47a4723ce16f65c7387c20a8c18a1c13b.tar.xz
linux-e75e6bf47a4723ce16f65c7387c20a8c18a1c13b.zip
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>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/mm/init.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 9914ca0d789b..a2f4c148f02e 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -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);
}