Skip to content

Commit

Permalink
ocfs2: clean up redundant NULL checks before kfree
Browse files Browse the repository at this point in the history
NULL check before kfree is redundant and so clean them up.

Signed-off-by: Joseph Qi <[email protected]>
Reviewed-by: Mark Fasheh <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
josephhz authored and torvalds committed Sep 4, 2015
1 parent 7ecef14 commit 4635929
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fs/ocfs2/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6178,7 +6178,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
iput(tl_inode);
brelse(tl_bh);

if (status < 0 && (*tl_copy)) {
if (status < 0) {
kfree(*tl_copy);
*tl_copy = NULL;
mlog_errno(status);
Expand Down
6 changes: 2 additions & 4 deletions fs/ocfs2/suballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac)
brelse(ac->ac_bh);
ac->ac_bh = NULL;
ac->ac_resv = NULL;
if (ac->ac_find_loc_priv) {
kfree(ac->ac_find_loc_priv);
ac->ac_find_loc_priv = NULL;
}
kfree(ac->ac_find_loc_priv);
ac->ac_find_loc_priv = NULL;
}

void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac)
Expand Down

0 comments on commit 4635929

Please sign in to comment.