From: Dan Carpenter <error27@gmail.com>
To: Callan McClish <mcclishcallan@gmail.com>
Cc: linux-staging@lists.linux.dev, gregkh@linuxfoundation.org
Subject: Re: [PATCH] staging: rtl8723bs: remove unnecessary NULL check before kfree
Date: Mon, 21 Sep 2026 15:57:17 +0300 [thread overview]
Message-ID: <arEprRBNPaPeYEa-@stanley.mountain> (raw)
In-Reply-To: <20260920233053.2311209-1-mcclishcallan@gmail.com>
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
prev parent reply other threads:[~2026-09-21 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 23:30 [PATCH] staging: rtl8723bs: remove unnecessary NULL check before kfree Callan McClish
2026-09-21 12:57 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arEprRBNPaPeYEa-@stanley.mountain \
--to=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
--cc=mcclishcallan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox