* [PATCH] sysv: delete unnecessary checks before brelse()
@ 2022-08-19 8:13 cgel.zte
0 siblings, 0 replies; only message in thread
From: cgel.zte @ 2022-08-19 8:13 UTC (permalink / raw)
To: hch; +Cc: linux-kernel, Minghao Chi, Zeal Robot
From: Minghao Chi <chi.minghao@zte.com.cn>
The brelse() function tests whether its argument is NULL
and then returns immediately.
Thus remove the tests which are not needed around the shown calls.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
fs/sysv/balloc.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/sysv/balloc.c b/fs/sysv/balloc.c
index 0e69dbdf7277..dd7fdc728ba7 100644
--- a/fs/sysv/balloc.c
+++ b/fs/sysv/balloc.c
@@ -195,8 +195,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
break;
block = fs32_to_cpu(sbi, zone);
- if (bh)
- brelse(bh);
+ brelse(bh);
if (block < sbi->s_firstdatazone || block >= sbi->s_nzones)
goto Einval;
@@ -207,8 +206,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
n = fs16_to_cpu(sbi, *(__fs16*)bh->b_data);
blocks = get_chunk(sb, bh);
}
- if (bh)
- brelse(bh);
+ brelse(bh);
if (count != sb_count)
goto Ecount;
done:
@@ -224,8 +222,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
goto trust_sb;
E2big:
printk("sysv_count_free_blocks: >flc_size entries in free-list block\n");
- if (bh)
- brelse(bh);
+ brelse(bh);
trust_sb:
count = sb_count;
goto done;
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-19 8:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19 8:13 [PATCH] sysv: delete unnecessary checks before brelse() cgel.zte
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®