Re: [v3 1/1] staging: rtl8723bs: Prevent duplicate NULL tests on a value

From: Samuel Abraham
Date: Fri Apr 04 2025 - 03:59:04 EST


On Fri, Apr 4, 2025 at 8:53 AM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Fri, Apr 4, 2025 at 3:03 AM Abraham Samuel Adekunle
> <abrahamadekunle50@xxxxxxxxx> 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.
>
> ...
>
> > + psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF;
>
> > + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] =
> > + (tx_seq + 1) & 0xfff;
>
> > + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] =
> > + (pattrib->seqnum + 1) % 4096;
>
> Logically it's obvious that you need to align all cases to have
> consistent approach.
> Besides that the commit message should mention this change. Something like this
> "While at it, convert '& 0xfff' cases to use modulo operator and
> decimal number to make the upper limit visible and clear what the
> semantic of it is."

Okay, I will do that.
Thank you for being so patient

Adekunle.