mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs: remove unnecessary NULL check before kvfree()
@ 2025-03-11  7:11 Chen Ni
  2025-03-11 16:01 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2025-03-11  7:11 UTC (permalink / raw)
  To: cem, djwong; +Cc: linux-xfs, linux-kernel, Chen Ni

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>
---
 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 57bef567e011..9688e8ca6915 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1144,8 +1144,7 @@ xfs_growfs_rtg(
 			goto out_error;
 	}
 
-	if (old_rsum_cache)
-		kvfree(old_rsum_cache);
+	kvfree(old_rsum_cache);
 	xfs_rtgroup_rele(rtg);
 	return 0;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: remove unnecessary NULL check before kvfree()
  2025-03-11  7:11 [PATCH] xfs: remove unnecessary NULL check before kvfree() Chen Ni
@ 2025-03-11 16:01 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2025-03-11 16:01 UTC (permalink / raw)
  To: Chen Ni; +Cc: cem, linux-xfs, linux-kernel

On Tue, Mar 11, 2025 at 03:11:14PM +0800, Chen Ni wrote:
> 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>

Probably fine, though the line numbers have moved around a lot in
for-next...

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  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 57bef567e011..9688e8ca6915 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -1144,8 +1144,7 @@ xfs_growfs_rtg(
>  			goto out_error;
>  	}
>  
> -	if (old_rsum_cache)
> -		kvfree(old_rsum_cache);
> +	kvfree(old_rsum_cache);
>  	xfs_rtgroup_rele(rtg);
>  	return 0;
>  
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-11 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-11  7:11 [PATCH] xfs: remove unnecessary NULL check before kvfree() Chen Ni
2025-03-11 16:01 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®