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>
This commit is contained in:
zhong jiang 2018-08-13 14:06:08 +08:00 committed by David Sterba
parent 4b6f8e9695
commit f8b00e0f06
1 changed files with 2 additions and 4 deletions

View File

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