Skip to contentSkip to conversation

ocfs2: clean up redundant NULL checks before kfree

Ocfs2-devel Joseph Qi 2 participants 2 messages Sep 1, 2015 OCFS2

lore
Share & tools
lore

Joseph Qi

author
#0 lore raw

NULL check before kfree is redundant and so clean them up.

---
 fs/ocfs2/alloc.c    | 2 +-
 fs/ocfs2/suballoc.c | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
fs/ocfs2/alloc.c +1 -1
index 5997c00..73f6684 100644
@@ -6175,7 +6175,7 @@ bail:
 		iput(tl_inode);
 	brelse(tl_bh);
 
-	if (status < 0 && (*tl_copy)) {
+	if (status < 0) {
 		kfree(*tl_copy);
 		*tl_copy = NULL;
 		mlog_errno(status);
fs/ocfs2/suballoc.c +2 -4
index 4479029..68a6a80 100644
@@ -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)
Signature · 1 line
1.8.4.3