linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] arch/nios2/mm/ioremap.c: fix bugon.cocci warnings
@ 2021-08-23  1:53 CGEL
  0 siblings, 0 replies; only message in thread
From: CGEL @ 2021-08-23  1:53 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: linux-kernel, Jing Yangyang, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

Use BUG_ON instead of a if condition followed by BUG.

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

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 arch/nios2/mm/ioremap.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/nios2/mm/ioremap.c b/arch/nios2/mm/ioremap.c
index fe821ef..67f73c1 100644
--- a/arch/nios2/mm/ioremap.c
+++ b/arch/nios2/mm/ioremap.c
@@ -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;
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-23  1:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  1:53 [PATCH linux-next] arch/nios2/mm/ioremap.c: fix bugon.cocci warnings CGEL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).