[PATCH linux-next] fs/ntfs/mft.c: fix bugon.cocci warnings

From: CGEL
Date: Wed Aug 25 2021 - 02:29:29 EST


From: Jing Yangyang <jing.yangyang@xxxxxxxxxx>

Use BUG_ON instead of a if condition followed by BUG.

Generated by: scripts/coccinelle/misc/bugon.cocci

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Jing Yangyang <jing.yangyang@xxxxxxxxxx>
---
fs/ntfs/mft.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 0d62cd5..588407a 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -577,8 +577,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
struct buffer_head *tbh = bhs[i_bhs];

- if (!trylock_buffer(tbh))
- BUG();
+ BUG_ON(!trylock_buffer(tbh));
BUG_ON(!buffer_uptodate(tbh));
clear_buffer_dirty(tbh);
get_bh(tbh);
--
1.8.3.1