Commit 72865d92 authored by Joseph Qi's avatar Joseph Qi Committed by Linus Torvalds

ocfs2: clean up redundant NULL check before iput

Since iput will take care the NULL check itself, NULL check before
calling it is redundant.  So clean them up.
Signed-off-by: default avatarJoseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b5560143
...@@ -6174,8 +6174,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb, ...@@ -6174,8 +6174,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
} }
bail: bail:
if (tl_inode) iput(tl_inode);
iput(tl_inode);
brelse(tl_bh); brelse(tl_bh);
if (status < 0) { if (status < 0) {
......
...@@ -606,9 +606,7 @@ static int ocfs2_info_freefrag_scan_bitmap(struct ocfs2_super *osb, ...@@ -606,9 +606,7 @@ static int ocfs2_info_freefrag_scan_bitmap(struct ocfs2_super *osb,
if (gb_inode) if (gb_inode)
mutex_unlock(&gb_inode->i_mutex); mutex_unlock(&gb_inode->i_mutex);
if (gb_inode) iput(gb_inode);
iput(gb_inode);
brelse(bh); brelse(bh);
return status; return status;
......
...@@ -1042,8 +1042,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) ...@@ -1042,8 +1042,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
// up_write(&journal->j_trans_barrier); // up_write(&journal->j_trans_barrier);
done: done:
if (inode) iput(inode);
iput(inode);
} }
static void ocfs2_clear_journal_error(struct super_block *sb, static void ocfs2_clear_journal_error(struct super_block *sb,
...@@ -1687,9 +1686,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, ...@@ -1687,9 +1686,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
if (got_lock) if (got_lock)
ocfs2_inode_unlock(inode, 1); ocfs2_inode_unlock(inode, 1);
if (inode) iput(inode);
iput(inode);
brelse(bh); brelse(bh);
return status; return status;
...@@ -1796,8 +1793,7 @@ static int ocfs2_trylock_journal(struct ocfs2_super *osb, ...@@ -1796,8 +1793,7 @@ static int ocfs2_trylock_journal(struct ocfs2_super *osb,
ocfs2_inode_unlock(inode, 1); ocfs2_inode_unlock(inode, 1);
bail: bail:
if (inode) iput(inode);
iput(inode);
return status; return status;
} }
......
...@@ -358,8 +358,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb) ...@@ -358,8 +358,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
bail: bail:
if (status < 0) if (status < 0)
brelse(alloc_bh); brelse(alloc_bh);
if (inode) iput(inode);
iput(inode);
trace_ocfs2_load_local_alloc(osb->local_alloc_bits); trace_ocfs2_load_local_alloc(osb->local_alloc_bits);
...@@ -473,8 +472,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) ...@@ -473,8 +472,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
iput(main_bm_inode); iput(main_bm_inode);
out: out:
if (local_alloc_inode) iput(local_alloc_inode);
iput(local_alloc_inode);
kfree(alloc_copy); kfree(alloc_copy);
} }
...@@ -1327,9 +1325,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, ...@@ -1327,9 +1325,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
brelse(main_bm_bh); brelse(main_bm_bh);
if (main_bm_inode) iput(main_bm_inode);
iput(main_bm_inode);
kfree(alloc_copy); kfree(alloc_copy);
if (ac) if (ac)
......
...@@ -1683,8 +1683,7 @@ static int ocfs2_rename(struct inode *old_dir, ...@@ -1683,8 +1683,7 @@ static int ocfs2_rename(struct inode *old_dir,
if (new_inode) if (new_inode)
sync_mapping_buffers(old_inode->i_mapping); 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(&target_lookup_res);
ocfs2_free_dir_lookup_result(&old_entry_lookup); ocfs2_free_dir_lookup_result(&old_entry_lookup);
......
...@@ -322,8 +322,7 @@ static void __ocfs2_free_slot_info(struct ocfs2_slot_info *si) ...@@ -322,8 +322,7 @@ static void __ocfs2_free_slot_info(struct ocfs2_slot_info *si)
if (si == NULL) if (si == NULL)
return; return;
if (si->si_inode) iput(si->si_inode);
iput(si->si_inode);
if (si->si_bh) { if (si->si_bh) {
for (i = 0; i < si->si_blocks; i++) { for (i = 0; i < si->si_blocks; i++) {
if (si->si_bh[i]) { if (si->si_bh[i]) {
......
...@@ -1722,8 +1722,7 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -1722,8 +1722,7 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
ocfs2_inode_unlock(inode, 0); ocfs2_inode_unlock(inode, 0);
status = 0; status = 0;
bail: bail:
if (inode) iput(inode);
iput(inode);
if (status) if (status)
mlog_errno(status); mlog_errno(status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment