staging: rtl8723bs: remove unnecessary NULL check before kfree
PATCH 1/1 staging: rtl8723bs: remove unnecessary NULL check before kfree
kfree(NULL) is a safe operation and an explicit NULL check is redundant, therefore it should be omitted.
Detected by checkpatch.
--- drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_xmit.c +2 -3
@@ -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;
Signature · 1 line
2.55.0
Quoted 14 lines · 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 <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_xmit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/rtl8723bs/core/rtw_xmit.c +0
-0
drivers/staging/rtl8723bs/core/rtw_xmit.c s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram · line 1754
Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_xmit.c +2
-3@@ -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/[email protected]/
I guess this still works as a lesson in ignoring checkpatch and being skeptical of advice from tools...
regards,
dan carpenter