linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jose Abreu <Jose.Abreu@synopsys.com>
To: David Miller <davem@davemloft.net>,
	"Jose.Abreu@synopsys.com" <Jose.Abreu@synopsys.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Joao.Pinto@synopsys.com" <Joao.Pinto@synopsys.com>,
	"peppe.cavallaro@st.com" <peppe.cavallaro@st.com>,
	"alexandre.torgue@st.com" <alexandre.torgue@st.com>,
	"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
	"linux-stm32@st-md-mailman.stormreply.com" 
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH net-next] net: stmmac: Fix sparse warning
Date: Mon, 7 Oct 2019 15:22:50 +0000	[thread overview]
Message-ID: <BN8PR12MB32660C9CE9B4F96517313E6BD39B0@BN8PR12MB3266.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20191007.161426.108032588372697075.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Oct/07/2019, 15:14:26 (UTC+00:00)

> From: Jose Abreu <Jose.Abreu@synopsys.com>
> Date: Mon,  7 Oct 2019 15:16:08 +0200
> 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 8b76745a7ec4..40b0756f3a14 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -4207,6 +4207,7 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le)
> >  static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> >  {
> >  	u32 crc, hash = 0;
> > +	__le16 pmatch = 0;
> >  	int count = 0;
> >  	u16 vid = 0;
> >  
> > @@ -4221,11 +4222,11 @@ static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> >  		if (count > 2) /* VID = 0 always passes filter */
> >  			return -EOPNOTSUPP;
> >  
> > -		vid = cpu_to_le16(vid);
> > +		pmatch = cpu_to_le16(vid);
> >  		hash = 0;
> >  	}
> >  
> > -	return stmmac_update_vlan_hash(priv, priv->hw, hash, vid, is_double);
> > +	return stmmac_update_vlan_hash(priv, priv->hw, hash, pmatch, is_double);
> >  }
> 
> I dunno about this.
> 
> The original code would use the last "vid" iterated over in the
> for_each_set_bit() loop if the priv->dma_cap.vlhash test does not
> pass.
> 
> Now, it will use zero in that case.
> 
> This does not look like an equivalent transformation.

It is intended behavior. HW specific callbacks: 
dwmac4_update_vlan_hash() / dwxgmac2_update_vlan_hash(), will either use 
Hash method or Perfect method so if priv->dma_cap.vlhash is not 
available then pmatch will be last vid. Otherwise, it will be zero and 
hash will be populated.

---
Thanks,
Jose Miguel Abreu

      reply	other threads:[~2019-10-07 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 13:16 [PATCH net-next] net: stmmac: Fix sparse warning Jose Abreu
2019-10-07 14:14 ` David Miller
2019-10-07 15:22   ` Jose Abreu [this message]

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=BN8PR12MB32660C9CE9B4F96517313E6BD39B0@BN8PR12MB3266.namprd12.prod.outlook.com \
    --to=jose.abreu@synopsys.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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).