Re: [PATCH v2 3/3] staging: rtl8723bs: Prevent duplicate NULL tests on a value
Samuel Abraham <[email protected]> Fri, 4 Apr 2025 00:34:40 +0100
| Newsgroups | dev.linux.lists.outreachy,dev.linux.lists.linux-staging,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CADYq+fY-y1BqnzK7fCvjPhLfvpTgMeiK5_XCoF_BZqiYyX_1bw@mail.gmail.com> |
On Thu, Apr 3, 2025 at 2:40 PM Andy Shevchenko <[email protected]> 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