Re: [v3 1/1] staging: rtl8723bs: Prevent duplicate NULL tests on a value
Samuel Abraham <[email protected]> Fri, 4 Apr 2025 08:58:44 +0100
| Newsgroups | dev.linux.lists.outreachy,dev.linux.lists.linux-staging,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CADYq+fYU=rb1EBgv0U87mFMFe2ct87g05GEyu8oG9=+xHjccyg@mail.gmail.com> |
On Fri, Apr 4, 2025 at 8:53 AM Andy Shevchenko <[email protected]> wrote: > > On Fri, Apr 4, 2025 at 3:03 AM Abraham Samuel Adekunle > <[email protected]> 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.