From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A58CC47404 for ; Mon, 7 Oct 2019 14:14:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27A18206C2 for ; Mon, 7 Oct 2019 14:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728310AbfJGOO3 (ORCPT ); Mon, 7 Oct 2019 10:14:29 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:53146 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbfJGOO3 (ORCPT ); Mon, 7 Oct 2019 10:14:29 -0400 Received: from localhost (unknown [144.121.20.163]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id B623614218221; Mon, 7 Oct 2019 07:14:27 -0700 (PDT) Date: Mon, 07 Oct 2019 16:14:26 +0200 (CEST) Message-Id: <20191007.161426.108032588372697075.davem@davemloft.net> To: Jose.Abreu@synopsys.com Cc: netdev@vger.kernel.org, Joao.Pinto@synopsys.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, mcoquelin.stm32@gmail.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net: stmmac: Fix sparse warning From: David Miller In-Reply-To: References: X-Mailer: Mew version 6.8 on Emacs 26.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 07 Oct 2019 07:14:28 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jose Abreu 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.