Re: [PATCH 2/2] staging: rtl8723bs: Prevent duplicate NULL tests on a value
Andy Shevchenko <[email protected]> Thu, 3 Apr 2025 08:26:58 +0300
| Newsgroups | dev.linux.lists.outreachy,dev.linux.lists.linux-staging,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAHp75VegJ+DgG1g2PJ0WQMUFpMrt1aJOb_NgvzL90NsuD_Oosg@mail.gmail.com> |
On Thu, Apr 3, 2025 at 2:30 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 ... > - if (psta) { > + { > psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; > psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; > pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority]; Same comment, shift left and remove pointless {} altogether. -- With Best Regards, Andy Shevchenko