public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] iavf: Remove useless else if
Date: Fri, 19 May 2023 13:54:38 +0200	[thread overview]
Message-ID: <ZGdjfn1anf/DJt1G@corigine.com> (raw)
In-Reply-To: <20230519083848.58828-1-jiapeng.chong@linux.alibaba.com>

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

  reply	other threads:[~2023-05-19 11:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  8:38 [PATCH] iavf: Remove useless else if Jiapeng Chong
2023-05-19 11:54 ` Simon Horman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-09  3:32 Jiapeng Chong
2022-09-12 22:01 ` Tony Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZGdjfn1anf/DJt1G@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=abaci@linux.alibaba.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox