Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: remove redundant kfree check in rtw_xmit.c
@ 2026-06-19  2:29 Andrezinrc
  2026-06-19  7:59 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Andrezinrc @ 2026-06-19  2:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Andrezinrc

Remove the redundant null check before calling kfree. ccheckpatch
reminds us that kfree(NULL) is safe and this check is not required.

Signed-off-by: Andrezinrc <andrem.33333@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 7bce0343d..92e818705 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -1736,10 +1736,9 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram
 		pxmitframe->pkt = NULL;
 	}
 
-	if (pxmitframe->alloc_addr) {
-		kfree(pxmitframe->alloc_addr);
+	kfree(pxmitframe->alloc_addr);
+	if (pxmitframe->alloc_addr)
 		goto check_pkt_complete;
-	}
 
 	if (pxmitframe->ext_tag == 0)
 		queue = &pxmitpriv->free_xmit_queue;
-- 
2.43.0


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

* Re: [PATCH] staging: rtl8723bs: remove redundant kfree check in rtw_xmit.c
  2026-06-19  2:29 [PATCH] staging: rtl8723bs: remove redundant kfree check in rtw_xmit.c Andrezinrc
@ 2026-06-19  7:59 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-06-19  7:59 UTC (permalink / raw)
  To: Andrezinrc; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On Thu, Jun 18, 2026 at 11:29:38PM -0300, Andrezinrc wrote:
> Remove the redundant null check before calling kfree. ccheckpatch
> reminds us that kfree(NULL) is safe and this check is not required.
> 
> Signed-off-by: Andrezinrc <andrem.33333@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> index 7bce0343d..92e818705 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> @@ -1736,10 +1736,9 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram
>  		pxmitframe->pkt = NULL;
>  	}
>  
> -	if (pxmitframe->alloc_addr) {
> -		kfree(pxmitframe->alloc_addr);
> +	kfree(pxmitframe->alloc_addr);
> +	if (pxmitframe->alloc_addr)
>  		goto check_pkt_complete;
> -	}

The code was more readable before.

regards,
dan carpenter


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

end of thread, other threads:[~2026-06-19  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-19  2:29 [PATCH] staging: rtl8723bs: remove redundant kfree check in rtw_xmit.c Andrezinrc
2026-06-19  7:59 ` Dan Carpenter

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