Skip to contentSkip to conversation

ocfs2:Use BUG_ON instead of if condition followed by BUG.

PATCH Applied [email protected] 2 participants 2 messages Nov 5, 2021 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2:Use BUG_ON instead of if condition followed by BUG.

From: Zhang Mingyu <[email protected]>

This issue was detected with the help of Coccinelle.

---
 fs/ocfs2/journal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ocfs2/journal.c +2 -4
index dbf9b9e97d74..1887a2708709 100644
@@ -1669,8 +1669,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 	status = jbd2_journal_load(journal);
 	if (status < 0) {
 		mlog_errno(status);
-		if (!igrab(inode))
-			BUG();
+		BUG_ON(!igrab(inode));
 		jbd2_journal_destroy(journal);
 		goto done;
 	}
@@ -1699,8 +1698,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 	if (status < 0)
 		mlog_errno(status);
 
-	if (!igrab(inode))
-		BUG();
+	BUG_ON(!igrab(inode));
 
 	jbd2_journal_destroy(journal);
 
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On 11/5/21 9:44 AM, [email protected] wrote:

From: Zhang Mingyu <[email protected]>

This issue was detected with the help of Coccinelle.

Quoted 29 lines
---
 fs/ocfs2/journal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ocfs2/journal.c +2 -4
index dbf9b9e97d74..1887a2708709 100644
@@ -1669,8 +1669,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 	status = jbd2_journal_load(journal);
 	if (status < 0) {
 		mlog_errno(status);
-		if (!igrab(inode))
-			BUG();
+		BUG_ON(!igrab(inode));
 		jbd2_journal_destroy(journal);
 		goto done;
 	}
@@ -1699,8 +1698,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 	if (status < 0)
 		mlog_errno(status);
 
-	if (!igrab(inode))
-		BUG();
+	BUG_ON(!igrab(inode));
 
 	jbd2_journal_destroy(journal);