2015-06-23 05:59:37

by Maninder Singh

[permalink] [raw]
Subject: [PATCH 1/1] Btrfs: Remove redundant NULL check before kfree

There is no need of NULL check before kfree,
removing the same

Signed-off-by: Maninder Singh <[email protected]>
Reviewed-by: Akhilesh Kumar <[email protected]>
---
fs/btrfs/free-space-cache.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 9dbe5b5..88f1e16 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2101,8 +2101,7 @@ new_bitmap:

out:
if (info) {
- if (info->bitmap)
- kfree(info->bitmap);
+ kfree(info->bitmap);
kmem_cache_free(btrfs_free_space_cachep, info);
}

@@ -3561,8 +3560,7 @@ again:

if (info)
kmem_cache_free(btrfs_free_space_cachep, info);
- if (map)
- kfree(map);
+ kfree(map);
return 0;
}

--
1.7.9.5


2015-06-23 12:05:05

by David Sterba

[permalink] [raw]
Subject: Re: [PATCH 1/1] Btrfs: Remove redundant NULL check before kfree

On Tue, Jun 23, 2015 at 11:28:00AM +0530, Maninder Singh wrote:
> There is no need of NULL check before kfree,
> removing the same
>
> Signed-off-by: Maninder Singh <[email protected]>
> Reviewed-by: Akhilesh Kumar <[email protected]>

Reviewed-by: David Sterba <[email protected]>