Browse Source

btrfs: remove unneeded NULL checks before kfree

Kfree has taken the NULL pointer into account. So remove the check
before kfree.

The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
zhong jiang 7 years ago
parent
commit
f8b00e0f06
1 changed files with 2 additions and 4 deletions
  1. 2 4
      fs/btrfs/free-space-cache.c

+ 2 - 4
fs/btrfs/free-space-cache.c

@@ -2110,8 +2110,7 @@ new_bitmap:
 
 out:
 	if (info) {
-		if (info->bitmap)
-			kfree(info->bitmap);
+		kfree(info->bitmap);
 		kmem_cache_free(btrfs_free_space_cachep, info);
 	}
 
@@ -3601,8 +3600,7 @@ again:
 
 	if (info)
 		kmem_cache_free(btrfs_free_space_cachep, info);
-	if (map)
-		kfree(map);
+	kfree(map);
 	return 0;
 }