[PATCH -next V2] xfs: remove unnecessary NULL check before kvfree()

Chen Ni posted 1 patch 9 months, 1 week ago
fs/xfs/xfs_rtalloc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH -next V2] xfs: remove unnecessary NULL check before kvfree()
Posted by Chen Ni 9 months, 1 week ago
Remove unnecessary NULL check before kvfree() reported by
Coccinelle/coccicheck and the semantic patch at
scripts/coccinelle/free/ifnullfree.cocci.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
---
Changelog:

v1 -> v2:

1. rebase it on top of for-next.
---
 fs/xfs/xfs_rtalloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 9a99629d7de4..3aa222ea9500 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1212,8 +1212,7 @@ xfs_growfs_rtg(
 			goto out_error;
 	}
 
-	if (old_rsum_cache)
-		kvfree(old_rsum_cache);
+	kvfree(old_rsum_cache);
 	goto out_rele;
 
 out_error:
-- 
2.25.1
Re: [PATCH -next V2] xfs: remove unnecessary NULL check before kvfree()
Posted by Carlos Maiolino 9 months, 1 week ago
On Thu, 13 Mar 2025 11:28:59 +0800, Chen Ni wrote:
> Remove unnecessary NULL check before kvfree() reported by
> Coccinelle/coccicheck and the semantic patch at
> scripts/coccinelle/free/ifnullfree.cocci.
> 
> 

Applied to for-next, thanks!

[1/1] xfs: remove unnecessary NULL check before kvfree()
      commit: ef0f5bd5dd6233dd7952cea93ad80f3d7e45ad85

Best regards,
-- 
Carlos Maiolino <cem@kernel.org>
Re: [PATCH -next V2] xfs: remove unnecessary NULL check before kvfree()
Posted by Christoph Hellwig 9 months, 1 week ago
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>