diff mbox series

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

Message ID 20211105014424.75372-1-zhang.mingyu@zte.com.cn (mailing list archive)
State New, archived
Headers show
Series ocfs2:Use BUG_ON instead of if condition followed by BUG. | expand

Commit Message

CGEL Nov. 5, 2021, 1:44 a.m. UTC
From: Zhang Mingyu <zhang.mingyu@zte.com.cn>

This issue was detected with the help of Coccinelle.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Zhang Mingyu <zhang.mingyu@zte.com.cn>
---
 fs/ocfs2/journal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Joseph Qi Nov. 5, 2021, 1:54 a.m. UTC | #1
On 11/5/21 9:44 AM, cgel.zte@gmail.com wrote:
> From: Zhang Mingyu <zhang.mingyu@zte.com.cn>
> 
> This issue was detected with the help of Coccinelle.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Zhang Mingyu <zhang.mingyu@zte.com.cn>

Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/journal.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index dbf9b9e97d74..1887a2708709 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -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);
>  
>
diff mbox series

Patch

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index dbf9b9e97d74..1887a2708709 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -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);