linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] iavf: Remove useless else if
@ 2023-05-24 10:02 Jiapeng Chong
  2023-05-24 15:51 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-05-24 10:02 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>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5255
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
Changes in v2:
  -Add a comment.

 drivers/net/ethernet/intel/iavf/iavf_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 2de4baff4c20..da5011359425 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2200,9 +2200,9 @@ 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 /* The branch cover "else if (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] 2+ messages in thread

* Re: [PATCH v2] iavf: Remove useless else if
  2023-05-24 10:02 [PATCH v2] iavf: Remove useless else if Jiapeng Chong
@ 2023-05-24 15:51 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2023-05-24 15:51 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: jesse.brandeburg, anthony.l.nguyen, davem, edumazet, pabeni,
	intel-wired-lan, netdev, linux-kernel, Abaci Robot

On Wed, 24 May 2023 18:02:03 +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>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5255
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Looking thru git history most of the patches you send for this check
are converting perfectly valid code. Please change the check to ignore

if (cond)
	/*A*/
else if (cond2)
	/*B*/
else
	/*B*/
-- 
pw-bot: reject

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-24 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 10:02 [PATCH v2] iavf: Remove useless else if Jiapeng Chong
2023-05-24 15:51 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).