Re: [v3 1/1] staging: rtl8723bs: Prevent duplicate NULL tests on a value
Andy Shevchenko <[email protected]> Fri, 4 Apr 2025 10:53:22 +0300
| Newsgroups | dev.linux.lists.outreachy,dev.linux.lists.linux-staging,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAHp75Vem1E9wmmfXWsbawj2f+F=UkfzML7HyAnhTdsUqvjW91g@mail.gmail.com> |
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." -- With Best Regards, Andy Shevchenko