Re: [PATCH 2/2] staging: rtl8723bs: Prevent duplicate NULL tests on a value

From: Andy Shevchenko
Date: Thu Apr 03 2025 - 01:27:45 EST


On Thu, Apr 3, 2025 at 2:30 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

...

> - 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