Skip to contentSkip to conversation

arch/nios2/mm/ioremap.c: fix bugon.cocci warnings

PATCH New CGEL 1 participant 1 message Aug 23, 2021 NIOS2 architecture

lore
Share & tools
lore

CGEL

author
#0 lore raw

PATCH 1/1 arch/nios2/mm/ioremap.c: fix bugon.cocci warnings

From: Jing Yangyang <[email protected]>

Use BUG_ON instead of a if condition followed by BUG.

Generated by: scripts/coccinelle/misc/bugon.cocci

---
 arch/nios2/mm/ioremap.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/nios2/mm/ioremap.c +3 -6
index fe821ef..67f73c1 100644
@@ -32,8 +32,7 @@ static inline void remap_area_pte(pte_t *pte, unsigned long address,
 	end = address + size;
 	if (end > PMD_SIZE)
 		end = PMD_SIZE;
-	if (address >= end)
-		BUG();
+	BUG_ON(address >= end);
 	pfn = PFN_DOWN(phys_addr);
 	do {
 		if (!pte_none(*pte)) {
@@ -58,8 +57,7 @@ static inline int remap_area_pmd(pmd_t *pmd, unsigned long address,
 	if (end > PGDIR_SIZE)
 		end = PGDIR_SIZE;
 	phys_addr -= address;
-	if (address >= end)
-		BUG();
+	BUG_ON(address >= end);
 	do {
 		pte_t *pte = pte_alloc_kernel(pmd, address);
 
@@ -83,8 +81,7 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr,
 	phys_addr -= address;
 	dir = pgd_offset(&init_mm, address);
 	flush_cache_all();
-	if (address >= end)
-		BUG();
+	BUG_ON(address >= end);
 	do {
 		p4d_t *p4d;
 		pud_t *pud;
Signature · 1 line
1.8.3.1