* [PATCH] staging: rtl8723bs: remove unnecessary NULL check before kfree
@ 2026-09-20 23:30 Callan McClish
2026-09-21 12:57 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Callan McClish @ 2026-09-20 23:30 UTC (permalink / raw)
To: linux-staging; +Cc: gregkh, Callan McClish
kfree(NULL) is a safe operation and an explicit NULL check is redundant,
therefore it should be omitted.
Detected by checkpatch.
Signed-off-by: Callan McClish <mcclishcallan@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 81d9e713fc12..6aaa07813d46 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -1748,10 +1748,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.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] staging: rtl8723bs: remove unnecessary NULL check before kfree
2026-09-20 23:30 [PATCH] staging: rtl8723bs: remove unnecessary NULL check before kfree Callan McClish
@ 2026-09-21 12:57 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-09-21 12:57 UTC (permalink / raw)
To: Callan McClish; +Cc: linux-staging, gregkh
On Sun, Sep 20, 2026 at 04:30:40PM -0700, Callan McClish wrote:
> kfree(NULL) is a safe operation and an explicit NULL check is redundant,
> therefore it should be omitted.
> Detected by checkpatch.
>
> Signed-off-by: Callan McClish <mcclishcallan@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 81d9e713fc12..6aaa07813d46 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> @@ -1748,10 +1748,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;
> - }
Do a search on lore before sending patches... We need to add some
new drivers to staging because people seem to be doing the same
things over and over...
https://lore.kernel.org/all/ajT23QSZDVNdD8M_@stanley.mountain/
I guess this still works as a lesson in ignoring checkpatch and
being skeptical of advice from tools...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-21 12:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-20 23:30 [PATCH] staging: rtl8723bs: remove unnecessary NULL check before kfree Callan McClish
2026-09-21 12:57 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox