Skip to contentSkip to conversation

9p: Use BUG_ON instead of if condition followed by BUG.

PATCH In review [email protected] 2 participants 2 messages Nov 12, 2021 – Dec 18, 2021 9P file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 9p: 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/9p/vfs_file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/9p/vfs_file.c +1 -2
index 4244d48398ef..f2375448cafc 100644
@@ -139,8 +139,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)
Signature · 1 line
2.25.1
#1 lore raw

[email protected] wrote on Fri, Nov 12, 2021 at 09:25:47AM +0000:

Quoted 6 lines

From: Zhang Mingyu <[email protected]>

This issue was detected with the help of Coccinelle.

I realize I've never replied to this mail when applying old patches now, I've picked this up too.

Quoted 18 lines
---
 fs/9p/vfs_file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/9p/vfs_file.c +1 -2
index 4244d48398ef..f2375448cafc 100644
@@ -139,8 +139,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)
Signature · 1 line
Dominique