ocfs2: clean up redundant NULL check before iput
authorJoseph Qi <joseph.qi@huawei.com>
Thu, 14 Jan 2016 23:17:27 +0000 (15:17 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Jan 2016 00:00:49 +0000 (16:00 -0800)
Since iput will take care the NULL check itself, NULL check before
calling it is redundant.  So clean them up.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/alloc.c
fs/ocfs2/ioctl.c
fs/ocfs2/journal.c
fs/ocfs2/localalloc.c
fs/ocfs2/namei.c
fs/ocfs2/slot_map.c
fs/ocfs2/super.c

index 2a0aeb77ec4250fa2c074ca68d7cf1cec2b03002..a3ded88718c93eec4bf9767018826c960285a07d 100644 (file)
@@ -6174,8 +6174,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
        }
 
 bail:
-       if (tl_inode)
-               iput(tl_inode);
+       iput(tl_inode);
        brelse(tl_bh);
 
        if (status < 0) {
index 3cb097ccce607a8c0e6ebb1679a80542182f58b5..16b0bb482ea7cb68540c8fe7ea133b1bc89185ce 100644 (file)
@@ -606,9 +606,7 @@ bail:
        if (gb_inode)
                mutex_unlock(&gb_inode->i_mutex);
 
-       if (gb_inode)
-               iput(gb_inode);
-
+       iput(gb_inode);
        brelse(bh);
 
        return status;
index 13534f4fe5b51d0c009ad684be46518de65a85d8..3772a2dbb980c950279349146f14c4ec3887ead2 100644 (file)
@@ -1042,8 +1042,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
 
 //     up_write(&journal->j_trans_barrier);
 done:
-       if (inode)
-               iput(inode);
+       iput(inode);
 }
 
 static void ocfs2_clear_journal_error(struct super_block *sb,
@@ -1687,9 +1686,7 @@ done:
        if (got_lock)
                ocfs2_inode_unlock(inode, 1);
 
-       if (inode)
-               iput(inode);
-
+       iput(inode);
        brelse(bh);
 
        return status;
@@ -1796,8 +1793,7 @@ static int ocfs2_trylock_journal(struct ocfs2_super *osb,
 
        ocfs2_inode_unlock(inode, 1);
 bail:
-       if (inode)
-               iput(inode);
+       iput(inode);
 
        return status;
 }
index 0a4457fb0711b7c9f65cc3da788d482342d0a69d..e9c99e35f5ea74e160c158ca05b01371057d24d3 100644 (file)
@@ -358,8 +358,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 bail:
        if (status < 0)
                brelse(alloc_bh);
-       if (inode)
-               iput(inode);
+       iput(inode);
 
        trace_ocfs2_load_local_alloc(osb->local_alloc_bits);
 
@@ -473,8 +472,7 @@ out_mutex:
        iput(main_bm_inode);
 
 out:
-       if (local_alloc_inode)
-               iput(local_alloc_inode);
+       iput(local_alloc_inode);
 
        kfree(alloc_copy);
 }
@@ -1327,9 +1325,7 @@ bail:
 
        brelse(main_bm_bh);
 
-       if (main_bm_inode)
-               iput(main_bm_inode);
-
+       iput(main_bm_inode);
        kfree(alloc_copy);
 
        if (ac)
index afb81eae2c1876f595e8f24446fb19bb992bb313..714320e420eb4f0f0062f4b10483c507cd384aa9 100644 (file)
@@ -1683,8 +1683,7 @@ bail:
        if (new_inode)
                sync_mapping_buffers(old_inode->i_mapping);
 
-       if (new_inode)
-               iput(new_inode);
+       iput(new_inode);
 
        ocfs2_free_dir_lookup_result(&target_lookup_res);
        ocfs2_free_dir_lookup_result(&old_entry_lookup);
index e78a203d44c832d8d638782984752cfc87e924b8..47bba1be2a51f6d89ee95fdd91213d40f4c9192e 100644 (file)
@@ -322,8 +322,7 @@ static void __ocfs2_free_slot_info(struct ocfs2_slot_info *si)
        if (si == NULL)
                return;
 
-       if (si->si_inode)
-               iput(si->si_inode);
+       iput(si->si_inode);
        if (si->si_bh) {
                for (i = 0; i < si->si_blocks; i++) {
                        if (si->si_bh[i]) {
index 64dcd787fa8043f87ccab4a49233c79a7a110402..c62d761d6bf013d91d4c531dbb47d317cbe6b85a 100644 (file)
@@ -1722,8 +1722,7 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
        ocfs2_inode_unlock(inode, 0);
        status = 0;
 bail:
-       if (inode)
-               iput(inode);
+       iput(inode);
 
        if (status)
                mlog_errno(status);