Re: [PATCH v2 3/3] staging: rtl8723bs: Prevent duplicate NULL tests on a value

Samuel Abraham
2025-04-03T23:34:49Z

On Thu, Apr 3, 2025 at 2:40 PM Andy Shevchenko <andy@kernel.org> wrote:
>
> On Thu, Apr 03, 2025 at 02:26:43PM +0100, Abraham Samuel Adekunle wrote:
> > When a value has been tested for NULL in an expression, a
> > second NULL test on the same value in another expression
> > is unnecessary when the value has not been assigned NULL.
> >
> > Remove unnecessary duplicate NULL tests on the same value that
> > has previously been NULL tested.
> >
> > Found by Coccinelle
>
> Missing period.

Noted.
...
> > + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq+1)&0xfff;
>
> While at it, make this more readable:
>
> psta->BA_starting_seqctrl[pattrib->priority & 0x0f] =
> (tx_seq + 1) & 0xfff;
>
>
> > + pattrib->ampdu_en = true;/* AGG EN */
> > + } else {
>
> > + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (pattrib->seqnum+1)&0xfff;
>
> Ditto.
>
> Also consider to use module operator as it shows the exact amount of the
> records we support in the circular buffer.
>
> psta->BA_starting_seqctrl[pattrib->priority & 0x0f] =
> (pattrib->seqnum + 1) % 4096;
>
> Since it's power-of-two denominator, it will be optimised by the compiler to
> the same code as it's now.
>
> > + pattrib->ampdu_en = true;/* AGG EN */
> > }
>
>
Thank you very much for the review
I will send an updated Patchset

Adekunle