Skip to contentSkip to conversation

staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG

PATCH New Hariprasad Kelam 2 participants 3 messages May 19, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG

fix below warning reported by coccicheck

drivers/staging/erofs/unzip_pagevec.h:74:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.

Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
-----
Changes in v2:
- replace BUG_ON with DBG_BUGON
-----

---
 drivers/staging/erofs/unzip_pagevec.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/erofs/unzip_pagevec.h +1 -2
index f37d8fd..7938ee3 100644
@@ -70,8 +70,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor,
 			return tagptr_unfold_ptr(t);
 	}
 
-	if (unlikely(nr >= ctor->nr))
-		BUG();
+	DBG_BUGON(nr >= ctor->nr);
 
 	return NULL;
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG

Quoted 19 lines · Hariprasad Kelam

fix below warning reported by coccicheck

drivers/staging/erofs/unzip_pagevec.h:74:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.

Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
-----
Changes in v2:
- replace BUG_ON with DBG_BUGON
-----

---
 drivers/staging/erofs/unzip_pagevec.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/erofs/unzip_pagevec.h +0 -0
index f37d8fd..7938ee3 100644

drivers/staging/erofs/unzip_pagevec.h z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor, · line 72

Quoted 3 lines
drivers/staging/erofs/unzip_pagevec.h +0 -0
@@ -70,8 +70,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor,
 			return tagptr_unfold_ptr(t);
 	}
 

I'd like to delete this line

drivers/staging/erofs/unzip_pagevec.h z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor, · line 74

Quoted 4 lines
drivers/staging/erofs/unzip_pagevec.h +1 -2
-	if (unlikely(nr >= ctor->nr))
-		BUG();
+	DBG_BUGON(nr >= ctor->nr);
 

and this line.. I have already sent a new patch based on your v1 patch, could you please check it out if it is acceptable for you? :)

Thanks,
Gao Xiang

Quoted 3 lines
drivers/staging/erofs/unzip_pagevec.h +0 -0
 	return NULL;
 }
#2 lore raw
Quoted 36 lines · Gao Xiang
Quoted 19 lines · Hariprasad Kelam

fix below warning reported by coccicheck

drivers/staging/erofs/unzip_pagevec.h:74:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.

Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
-----
Changes in v2:
- replace BUG_ON with DBG_BUGON
-----

---
 drivers/staging/erofs/unzip_pagevec.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/erofs/unzip_pagevec.h +0 -0
index f37d8fd..7938ee3 100644

drivers/staging/erofs/unzip_pagevec.h z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor, · line 72

Quoted 3 lines
drivers/staging/erofs/unzip_pagevec.h +0 -0
@@ -70,8 +70,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor,
 			return tagptr_unfold_ptr(t);
 	}
 

I'd like to delete this line

drivers/staging/erofs/unzip_pagevec.h z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor, · line 74

Quoted 4 lines
drivers/staging/erofs/unzip_pagevec.h +1 -2
-	if (unlikely(nr >= ctor->nr))
-		BUG();
+	DBG_BUGON(nr >= ctor->nr);
 

and this line.. I have already sent a new patch based on your v1 patch, could you please check it out if it is acceptable for you? :)

Quoted 2 lines

Thanks,
Gao Xiang

Hi Gai Xiang,

The patch which you sent has all required. Thanks for the patch. We can ignore this v2 patch.

Thanks,
Hariprasad k

Quoted 3 lines
Quoted 3 lines
drivers/staging/erofs/unzip_pagevec.h +0 -0
 	return NULL;
 }