9p: Use BUG_ON instead of if condition followed by BUG.
authorZhang Mingyu <zhang.mingyu@zte.com.cn>
Fri, 12 Nov 2021 09:25:47 +0000 (09:25 +0000)
committerDominique Martinet <asmadeus@codewreck.org>
Mon, 10 Jan 2022 01:00:09 +0000 (10:00 +0900)
This issue was detected with the help of Coccinelle.

Link: https://lkml.kernel.org/r/20211112092547.9153-1-zhang.mingyu@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Zhang Mingyu <zhang.mingyu@zte.com.cn>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
fs/9p/vfs_file.c

index b42b65e15b8133a2702f9678a53ca11a22d85049..ed0c85a2fb897e0fec83789c1b8d502525c683ec 100644 (file)
@@ -138,8 +138,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
        fid = filp->private_data;
        BUG_ON(fid == NULL);
 
-       if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
-               BUG();
+       BUG_ON((fl->fl_flags & FL_POSIX) != FL_POSIX);
 
        res = locks_lock_file_wait(filp, fl);
        if (res < 0)