* [PATCH] iavf: Remove useless else if
@ 2022-09-09 3:32 ` Jiapeng Chong
0 siblings, 0 replies; 6+ messages in thread
From: Jiapeng Chong @ 2022-09-09 3:32 UTC (permalink / raw)
To: jesse.brandeburg
Cc: anthony.l.nguyen, davem, edumazet, kuba, pabeni, intel-wired-lan,
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/ethernet/intel/iavf/iavf_main.c:2211:6-8: WARNING: possible condition with no effect (if == else).
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2106
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 1671e52b6ba2..e105ffeca074 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2208,9 +2208,7 @@ iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
vlan_ethertype = ETH_P_8021Q;
else if (prev_features & (NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX))
vlan_ethertype = ETH_P_8021AD;
- else if (prev_features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX))
- vlan_ethertype = ETH_P_8021Q;
- else
+ else /* contains prev_features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX) */
vlan_ethertype = ETH_P_8021Q;
if (!(features & (NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_CTAG_RX)))
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Intel-wired-lan] [PATCH] iavf: Remove useless else if
@ 2022-09-09 3:32 ` Jiapeng Chong
0 siblings, 0 replies; 6+ messages in thread
From: Jiapeng Chong @ 2022-09-09 3:32 UTC (permalink / raw)
To: jesse.brandeburg
Cc: Jiapeng Chong, intel-wired-lan, Abaci Robot, linux-kernel,
edumazet, netdev, kuba, pabeni, davem
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/ethernet/intel/iavf/iavf_main.c:2211:6-8: WARNING: possible condition with no effect (if == else).
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2106
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 1671e52b6ba2..e105ffeca074 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2208,9 +2208,7 @@ iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
vlan_ethertype = ETH_P_8021Q;
else if (prev_features & (NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX))
vlan_ethertype = ETH_P_8021AD;
- else if (prev_features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX))
- vlan_ethertype = ETH_P_8021Q;
- else
+ else /* contains prev_features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX) */
vlan_ethertype = ETH_P_8021Q;
if (!(features & (NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_CTAG_RX)))
--
2.20.1.7.g153144c
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] iavf: Remove useless else if
2022-09-09 3:32 ` [Intel-wired-lan] " Jiapeng Chong
@ 2022-09-12 22:01 ` Tony Nguyen
-1 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-12 22:01 UTC (permalink / raw)
To: Jiapeng Chong, jesse.brandeburg
Cc: davem, edumazet, kuba, pabeni, intel-wired-lan, netdev,
linux-kernel, Abaci Robot
On 9/8/2022 8:32 PM, Jiapeng Chong 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/ethernet/intel/iavf/iavf_main.c:2211:6-8: WARNING: possible condition with no effect (if == else).
This was already nacked by Jakub [1].
Thanks,
Tony
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2106
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
[1] https://lore.kernel.org/netdev/20220801091355.6ca23bcf@kernel.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] [PATCH] iavf: Remove useless else if
@ 2022-09-12 22:01 ` Tony Nguyen
0 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-12 22:01 UTC (permalink / raw)
To: Jiapeng Chong, jesse.brandeburg
Cc: netdev, Abaci Robot, linux-kernel, edumazet, intel-wired-lan,
kuba, pabeni, davem
On 9/8/2022 8:32 PM, Jiapeng Chong 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/ethernet/intel/iavf/iavf_main.c:2211:6-8: WARNING: possible condition with no effect (if == else).
This was already nacked by Jakub [1].
Thanks,
Tony
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2106
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
[1] https://lore.kernel.org/netdev/20220801091355.6ca23bcf@kernel.org/
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iavf: Remove useless else if
2023-05-19 8:38 Jiapeng Chong
@ 2023-05-19 11:54 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-05-19 11:54 UTC (permalink / raw)
To: Jiapeng Chong
Cc: jesse.brandeburg, anthony.l.nguyen, davem, edumazet, kuba,
pabeni, intel-wired-lan, netdev, linux-kernel, Abaci Robot
On Fri, May 19, 2023 at 04:38:48PM +0800, Jiapeng Chong wrote:
> The assignment of the else and if branches is the same, so the if else
> here is redundant, so we remove it.
>
> ./drivers/net/ethernet/intel/iavf/iavf_main.c:2203:6-8: WARNING: possible condition with no effect (if == else).
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=5255
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
nit: This should be targeted at net-next.
Subject: [PATCH net-next] ...
> ---
> drivers/net/ethernet/intel/iavf/iavf_main.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index 2de4baff4c20..cf8538cebfe0 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
> @@ -2200,8 +2200,6 @@ iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
> vlan_ethertype = ETH_P_8021Q;
> else if (prev_features & (NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX))
> vlan_ethertype = ETH_P_8021AD;
> - else if (prev_features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX))
> - vlan_ethertype = ETH_P_8021Q;
I agree that the assignment is the same.
But the current arrangement does very obviously handle
NETIF_F_HW_VLAN_CTAG_TX, whereas in the new arrangement
it's unclear if it is handled or forgotten.
Perhaps a comment is warranted here?
Something like this?
> else
/* This covers both the default and the
* (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX case.
*/
> vlan_ethertype = ETH_P_8021Q;
>
> --
> 2.20.1.7.g153144c
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] iavf: Remove useless else if
@ 2023-05-19 8:38 Jiapeng Chong
2023-05-19 11:54 ` Simon Horman
0 siblings, 1 reply; 6+ messages in thread
From: Jiapeng Chong @ 2023-05-19 8:38 UTC (permalink / raw)
To: jesse.brandeburg
Cc: anthony.l.nguyen, davem, edumazet, kuba, pabeni, intel-wired-lan,
netdev, linux-kernel, Jiapeng Chong, Abaci Robot
The assignment of the else and if branches is the same, so the if else
here is redundant, so we remove it.
./drivers/net/ethernet/intel/iavf/iavf_main.c:2203:6-8: WARNING: possible condition with no effect (if == else).
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=5255
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 2de4baff4c20..cf8538cebfe0 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2200,8 +2200,6 @@ iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
vlan_ethertype = ETH_P_8021Q;
else if (prev_features & (NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX))
vlan_ethertype = ETH_P_8021AD;
- else if (prev_features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX))
- vlan_ethertype = ETH_P_8021Q;
else
vlan_ethertype = ETH_P_8021Q;
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-05-19 11:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-09 3:32 [PATCH] iavf: Remove useless else if Jiapeng Chong
2022-09-09 3:32 ` [Intel-wired-lan] " Jiapeng Chong
2022-09-12 22:01 ` Tony Nguyen
2022-09-12 22:01 ` [Intel-wired-lan] " Tony Nguyen
2023-05-19 8:38 Jiapeng Chong
2023-05-19 11:54 ` Simon Horman
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.