# \[PATCH linux-next\] um: Replace if (cond) BUG() with BUG\_ON()

- From: CGEL \<hidden\>
- Date: 2021-08-28 01:11:21 
- List: linux-um
- Page: https://ratatoskr.run/linux-um/2021/08/1491001
- Thread: https://ratatoskr.run/linux-um/2021/08/1491001/t.md

```text
From: Changcheng Deng <redacted>

Fix the following coccinelle reports:

./arch/um/kernel/mem.c:89:2-5: WARNING: Use BUG_ON instead of if
condition followed by BUG.

Reported-by: Zeal Robot <redacted>
Signed-off-by: Changcheng Deng <redacted>
---
 arch/um/kernel/mem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 8e636ce..1810e69 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -85,8 +85,7 @@ static void __init one_md_table_init(pud_t *pud)
 		      __func__, PAGE_SIZE, PAGE_SIZE);
 
 	set_pud(pud, __pud(_KERNPG_TABLE + (unsigned long) __pa(pmd_table)));
-	if (pmd_table != pmd_offset(pud, 0))
-		BUG();
+	BUG_ON(pmd_table != pmd_offset(pud, 0));
 #endif
 }
 
-- 
1.8.3.1



_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

```
