mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Lee <eric.lee0305@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hungyu Lin <dennylin0707@gmail.com>,
	Andrei Khomenkov <khomenkov@mailbox.org>,
	Khushal Chitturi <khushalchitturi@gmail.com>,
	Ethan Tidmore <ethantidmore06@gmail.com>,
	Oskar Ray-Frayssinet <rayfraytech@gmail.com>,
	SeungJu Cheon <suunj1331@gmail.com>,
	Dalvin-Ehinoma Noah Aiguobas <fliegbert2@gmail.com>,
	Jennifer Guo <guojy.bj@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Eric LI (Honggang)" <eric.lee0305@gmail.com>
Subject: Re: [PATCH] staging: rtl8723bs: refactor xmit_xmitframe
Date: Thu, 1 Oct 2026 23:28:57 +0800	[thread overview]
Message-ID: <A4EEF5A3-75CF-4A4B-98CB-2EDEE2223C81@gmail.com> (raw)
In-Reply-To: <2026100121-chirpy-stomp-9fbe@gregkh>

On Oct 1, 2026, at 5:34 PM, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> Refactor it how?

The previous code handled two cases in one branch
- pxmitbuf is null, or
- pxmitbuf is not null, but is not enough for current pframe.

That causes an additional check of pxmitbuf in that branch.
In my refactoring, I split them.

Firstly, handle the second case. In this case, pxmitbuf is either
enqueued on pending_xmitbuf_queue, or released. In either way,
pxmitbuf is not owning that xmitbuf anymore.

Next, handle the first case. In this case, a new xmitbuf is
allocated for the current pframe.

Setting pxmitbuf to NULL in the second case in order to make sure
allocating a new xmitbuf for the pframe.


On Oct 1, 2026, at 5:34 PM, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> And is the output the same before/after?

The logic is not changed so the output are same.


On Oct 1, 2026, at 5:34 PM, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> > + pxmitbuf = NULL;

> This jumped out at me, why add this new line?

Two reasons to add this line:
1. pxmitbuf is not owning that xmitbuf anymore as it is either enqueued
on pending_xmitbuf_queue, or released.
2. a new xmitbuf is expected to be allocated for the current pframe.

So, it is safe to set pxmitbuf to NULL here, and it ensures
a new xmitbuf is allocated for the pframe.

      parent reply	other threads:[~2026-10-01 15:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 15:16 Eric LI (Honggang)
2026-10-01  9:34 ` Greg Kroah-Hartman
2026-10-01 10:42   ` Dan Carpenter
2026-10-01 15:28   ` Eric Lee [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=A4EEF5A3-75CF-4A4B-98CB-2EDEE2223C81@gmail.com \
    --to=eric.lee0305@gmail.com \
    --cc=dennylin0707@gmail.com \
    --cc=ethantidmore06@gmail.com \
    --cc=fliegbert2@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guojy.bj@gmail.com \
    --cc=khomenkov@mailbox.org \
    --cc=khushalchitturi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=rayfraytech@gmail.com \
    --cc=suunj1331@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

all inboxes | Powered by JetHome®