diff mbox series

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

Message ID 20250313032859.2094462-1-nichen@iscas.ac.cn (mailing list archive)
State Queued
Headers show
Series [-next,V2] xfs: remove unnecessary NULL check before kvfree() | expand

Commit Message

Chen Ni March 13, 2025, 3:28 a.m. UTC
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(-)

Comments

Christoph Hellwig March 13, 2025, 6:30 a.m. UTC | #1
Looks good:

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

Patch

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: