Re: [PATCH] staging: rtl8723bs: refactor xmit_xmitframe

From: Eric Lee

Date: Thu Oct 01 2026 - 11:37:01 EST


On Oct 1, 2026, at 5:34 PM, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx> 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.