add patch remove-redundant-condition-check
[ext4-patch-queue.git] / remove-redundant-condition-check
blob26fa25f80f0c69891e3a0af122d9fa116e62b682
1 ext4: remove redundant condition check
3 From: Chengguang Xu <cgxu519@gmx.com>
5 ext4_xattr_destroy_cache() can handle NULL pointer correctly,
6 so there is no need to check NULL pointer before calling
7 ext4_xattr_destroy_cache().
9 Reviewed-by: Jan Kara <jack@suse.cz>
10 Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 ---
13  fs/ext4/super.c | 29 +++++++++++++----------------
14  1 file changed, 13 insertions(+), 16 deletions(-)
16 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
17 index 53ff6c2a26ed..30d4a4e69de8 100644
18 --- a/fs/ext4/super.c
19 +++ b/fs/ext4/super.c
20 @@ -1000,14 +1000,13 @@ static void ext4_put_super(struct super_block *sb)
21                 invalidate_bdev(sbi->journal_bdev);
22                 ext4_blkdev_remove(sbi);
23         }
24 -       if (sbi->s_ea_inode_cache) {
25 -               ext4_xattr_destroy_cache(sbi->s_ea_inode_cache);
26 -               sbi->s_ea_inode_cache = NULL;
27 -       }
28 -       if (sbi->s_ea_block_cache) {
29 -               ext4_xattr_destroy_cache(sbi->s_ea_block_cache);
30 -               sbi->s_ea_block_cache = NULL;
31 -       }
33 +       ext4_xattr_destroy_cache(sbi->s_ea_inode_cache);
34 +       sbi->s_ea_inode_cache = NULL;
36 +       ext4_xattr_destroy_cache(sbi->s_ea_block_cache);
37 +       sbi->s_ea_block_cache = NULL;
39         if (sbi->s_mmp_tsk)
40                 kthread_stop(sbi->s_mmp_tsk);
41         brelse(sbi->s_sbh);
42 @@ -4522,14 +4521,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
43         if (EXT4_SB(sb)->rsv_conversion_wq)
44                 destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);
45  failed_mount_wq:
46 -       if (sbi->s_ea_inode_cache) {
47 -               ext4_xattr_destroy_cache(sbi->s_ea_inode_cache);
48 -               sbi->s_ea_inode_cache = NULL;
49 -       }
50 -       if (sbi->s_ea_block_cache) {
51 -               ext4_xattr_destroy_cache(sbi->s_ea_block_cache);
52 -               sbi->s_ea_block_cache = NULL;
53 -       }
54 +       ext4_xattr_destroy_cache(sbi->s_ea_inode_cache);
55 +       sbi->s_ea_inode_cache = NULL;
57 +       ext4_xattr_destroy_cache(sbi->s_ea_block_cache);
58 +       sbi->s_ea_block_cache = NULL;
60         if (sbi->s_journal) {
61                 jbd2_journal_destroy(sbi->s_journal);
62                 sbi->s_journal = NULL;
63 -- 
64 2.17.2