[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d50c16c1-0bc2-fdc4-16ab-0c27df824ffb@gmail.com>
Date: Thu, 23 Jun 2022 06:58:31 +0200
From: Philipp Hortmann <philipp.g.hortmann@...il.com>
To: Chang Yu <marcus.yu.56@...il.com>, Larry.Finger@...inger.net
Cc: linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: r8188eu: combine nested if statements into one
On 6/23/22 05:15, Chang Yu wrote:
> - if (padapter) {
> - if (pfree_recv_queue == &precvpriv->free_recv_queue)
> - precvpriv->free_recvframe_cnt++;
> - }
> + if (padapter && pfree_recv_queue == &precvpriv->free_recv_queue)
> + precvpriv->free_recvframe_cnt++;
Hi
tested with:
#include <stdio.h>
int main() {
char padapter = 1;
int pfree_recv_queue = 256;
int free_recv_queue = 256;
if (padapter) {
if (pfree_recv_queue == free_recv_queue)
printf("Executed before patch:
precvpriv->free_recvframe_cnt++;\n");
}
if (padapter && pfree_recv_queue == free_recv_queue)
printf("Executed after patch: precvpriv->free_recvframe_cnt++;\n");
return 0;
}
Seems to work. But the rules which operation is done first && or == are
not too easy. I would prefer to have:
if (padapter && (pfree_recv_queue == free_recv_queue))
So it is very easy to read what is evaluated first.
But this is just my opinion and does not have to be right.
Thanks for your patch.
Bye Philipp
Powered by blists - more mailing lists