ocfs2: use BUG_ON instead of if condition followed by BUG.
authorZhang Mingyu <zhang.mingyu@zte.com.cn>
Fri, 14 Jan 2022 22:03:35 +0000 (14:03 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 Jan 2022 14:30:24 +0000 (16:30 +0200)
This issue was detected with the help of Coccinelle.

Link: https://lkml.kernel.org/r/20211105014424.75372-1-zhang.mingyu@zte.com.cn
Signed-off-by: Zhang Mingyu <zhang.mingyu@zte.com.cn>
Reported-by: Zeal Robot <zealci@zte.com.cn>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/journal.c

index dbf9b9e97d7403d6310e2a710577c3bca8bee39c..1887a270870976cd742e2c44fdfcd5341647b779 100644 (file)
@@ -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);