[Linux-stm32] [PATCH net-next] net: stmmac: Fix sparse warning

David Miller davem at davemloft.net
Mon Oct 7 14:14:26 UTC 2019


From: Jose Abreu <Jose.Abreu at 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.



More information about the Linux-stm32 mailing list