linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: xiakaixu1987@gmail.com, Ion Badulescu <ionut@badula.org>
Cc: ionut@badula.org, leon@kernel.org, davem@davemloft.net,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kaixu Xia <kaixuxia@tencent.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] net: adaptec: remove dead code in set_vlan_mode
Date: Fri, 20 Nov 2020 15:17:14 -0800	[thread overview]
Message-ID: <20201120151714.0cc2f00b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <1605858600-7096-1-git-send-email-kaixuxia@tencent.com>

On Fri, 20 Nov 2020 15:50:00 +0800 xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The body of the if statement can be executed only when the variable
> vlan_count equals to 32, so the condition of the while statement can
> not be true and the while statement is dead code. Remove it.
> 
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> ---
>  drivers/net/ethernet/adaptec/starfire.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c
> index 555299737b51..ad27a9fa5e95 100644
> --- a/drivers/net/ethernet/adaptec/starfire.c
> +++ b/drivers/net/ethernet/adaptec/starfire.c
> @@ -1754,14 +1754,9 @@ static u32 set_vlan_mode(struct netdev_private *np)
>  		filter_addr += 16;
>  		vlan_count++;
>  	}
> -	if (vlan_count == 32) {
> +	if (vlan_count == 32)
>  		ret |= PerfectFilterVlan;
> -		while (vlan_count < 32) {
> -			writew(0, filter_addr);
> -			filter_addr += 16;
> -			vlan_count++;
> -		}
> -	}
> +
>  	return ret;
>  }
>  #endif /* VLAN_SUPPORT */

This got broken back in 2011:

commit 5da96be53a16a62488316810d0c7c5d58ce3ee4f
Author: Jiri Pirko <jpirko@redhat.com>
Date:   Wed Jul 20 04:54:31 2011 +0000

    starfire: do vlan cleanup
    
    - unify vlan and nonvlan rx path
    - kill np->vlgrp and netdev_vlan_rx_register
    
    Signed-off-by: Jiri Pirko <jpirko@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

The comparison to 32 was on a different variable before that change.

Ion, do you think anyone is still using this driver?

Maybe it's time we put it in the history book (by which I mean remove
from the kernel).

  reply	other threads:[~2020-11-20 23:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20  7:50 [PATCH] net: adaptec: remove dead code in set_vlan_mode xiakaixu1987
2020-11-20 23:17 ` Jakub Kicinski [this message]
2020-11-20 23:41   ` Ion Badulescu
2020-11-20 23:56     ` Jakub Kicinski
2020-11-21  0:15       ` Ion Badulescu

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=20201120151714.0cc2f00b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=ionut@badula.org \
    --cc=kaixuxia@tencent.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiakaixu1987@gmail.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;
as well as URLs for NNTP newsgroup(s).