* [PATCH] wifi: rt2x00: Remove useless else if
@ 2023-01-05 8:58 Jiapeng Chong
2023-01-05 13:57 ` Jiri Pirko
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-01-05 8:58 UTC (permalink / raw)
To: stf_xl
Cc: helmut.schaa, kvalo, davem, edumazet, kuba, pabeni,
linux-wireless, netdev, linux-kernel, Jiapeng Chong, Abaci Robot
The assignment of the else and else if branches is the same, so the else
if here is redundant, so we remove it and add a comment to make the code
here readable.
./drivers/net/wireless/ralink/rt2x00/rt2800lib.c:8927:9-11: WARNING: possible condition with no effect (if == else).
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3631
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 12b700c7b9c3..36b9cd4dd138 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -8924,9 +8924,7 @@ static void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev)
if (i < 2 && (bbptemp & 0x800000))
result = (bbptemp & 0xffffff) - 0x1000000;
- else if (i == 4)
- result = bbptemp;
- else
+ else /* This branch contains if(i==4) */
result = bbptemp;
if (i == 0)
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wifi: rt2x00: Remove useless else if
2023-01-05 8:58 [PATCH] wifi: rt2x00: Remove useless else if Jiapeng Chong
@ 2023-01-05 13:57 ` Jiri Pirko
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Pirko @ 2023-01-05 13:57 UTC (permalink / raw)
To: Jiapeng Chong
Cc: stf_xl, helmut.schaa, kvalo, davem, edumazet, kuba, pabeni,
linux-wireless, netdev, linux-kernel, Abaci Robot
Thu, Jan 05, 2023 at 09:58:02AM CET, jiapeng.chong@linux.alibaba.com wrote:
>The assignment of the else and else if branches is the same, so the else
>if here is redundant, so we remove it and add a comment to make the code
>here readable.
>
>./drivers/net/wireless/ralink/rt2x00/rt2800lib.c:8927:9-11: WARNING: possible condition with no effect (if == else).
>
>Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3631
>Reported-by: Abaci Robot <abaci@linux.alibaba.com>
>Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
>---
> drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
>diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
>index 12b700c7b9c3..36b9cd4dd138 100644
>--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
>+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
>@@ -8924,9 +8924,7 @@ static void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev)
>
> if (i < 2 && (bbptemp & 0x800000))
> result = (bbptemp & 0xffffff) - 0x1000000;
>- else if (i == 4)
>- result = bbptemp;
>- else
>+ else /* This branch contains if(i==4) */
I don't see how this comment is useful. Better to remove. One way or
another:
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> result = bbptemp;
>
> if (i == 0)
>--
>2.20.1.7.g153144c
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-05 13:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 8:58 [PATCH] wifi: rt2x00: Remove useless else if Jiapeng Chong
2023-01-05 13:57 ` Jiri Pirko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.