[net-next,v3,1/5] net: altera-tse: Initialize the regmap_config struct before using it
Message ID | 20230606152501.328789-2-maxime.chevallier@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3502456vqr; Tue, 6 Jun 2023 09:03:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6tNFZmvEhXIlGZGPt8UNlyMUu68LRC0yKxAcpCGULz7Vxr2ipdCOPpUZxG2wfJ+KIQaR1v X-Received: by 2002:a17:903:54d:b0:1b2:273f:2abd with SMTP id jo13-20020a170903054d00b001b2273f2abdmr1319955plb.46.1686067402821; Tue, 06 Jun 2023 09:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686067402; cv=none; d=google.com; s=arc-20160816; b=TP9oNTXI4VxbZHHhv+3/0K4A/jG3ME1mv5H2j5D5skclnYji34ELZIzN2FBvTPRo2u FUdPjpDOgxEnUIjU3z/0MsQFptO7lgHz34XyD+etaGTPPypGsXIz76jhJJqNwK/feKaz KBHOXczQ/FgGFe6ZtHnDvIaoW/qI9ZsofJauhFMjr0wJAweGKEdKZZ8Xx1gR9wyWOMm/ +d1R8xb6/BagKJMBCThuyPc/iowFCubMKy2E6CZeR9Em+wwRHeRNGlGQ8wPVPzhEFDID +uQnLGgQDo5hfh/xbRjsHQtOlVqXUyE4k7ndWcjBwQxSZw3NpGxR+Zw1zhZ6g+w3vHyd K9RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3nxUzUxzeLa0OD4Q5BuvGX8OJQ56jlO8Eull2jqeeVM=; b=KOpFuGcCGjRbdN1PEQX5DtPbryA38a+ARbKwDqsgxV2hBSxoaNjpA4sQsEjuWbV+gC HQV9KQ4QThNtyIOIYJlRMZAAvz70WvQECIuxwOEkUCGAonC2bbSYKhsuzG3NgZi5taHU W03xaDaI5eQgIl5qwW4AUmSwbw5BtDCYu29nxcgy383Ghno+2O1Mjss7igz2cX/4u0/R vZ5C2SznWeLaB6KCn7Dyf7+CgPf6WxnRVo49Vx4a4BQveVDNd/ZQnUqFklH1eSmVJHaW 7YSyoGenURX+qp1oe6fIh1UhYS55XRpaAh7X2GbDuUohq0TVTSxwRt6THI6HXNpk6+v/ 7+OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WMLEuwQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a170903018f00b001b05ca04190si7678422plg.65.2023.06.06.09.03.08; Tue, 06 Jun 2023 09:03:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WMLEuwQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236956AbjFFPZS (ORCPT <rfc822;xxoosimple@gmail.com> + 99 others); Tue, 6 Jun 2023 11:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236547AbjFFPZM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Jun 2023 11:25:12 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5772CE42; Tue, 6 Jun 2023 08:25:11 -0700 (PDT) X-GND-Sasl: maxime.chevallier@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686065109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3nxUzUxzeLa0OD4Q5BuvGX8OJQ56jlO8Eull2jqeeVM=; b=WMLEuwQYww0RaPTWgJV6hDyRaLUPczqmu71lsnUnyetPnEL/lPJdcTzVhkMB0scIrsTrzF bdUAG3c5vpwHZrNziNuJQQFSoENCwNjk9iYHM5eJi1uB1eGUSforUOIayrWIrDvA/xSaEc 8tFOzK7+XdFV131becSLX4cDUJ6nMBFyEBgv/tWUN7gfGqRMHB02Bf38tLDXy/EbIkBfKD ekkCuhPw2LY+RFXkTRqqHL5HhljTWoGd8JZGx73+FlgyKPxaxWOOwJ587EyW3cS5ZJnEIq lx8qlxWJO74CtXCHpe1QQy67azlqYKrB7yhz6+L620FVard8m5767Vh6wcJ4Ww== X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id DCA00FF811; Tue, 6 Jun 2023 15:25:06 +0000 (UTC) From: Maxime Chevallier <maxime.chevallier@bootlin.com> To: davem@davemloft.net Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alexis.lothore@bootlin.com, thomas.petazzoni@bootlin.com, Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, Florian Fainelli <f.fainelli@gmail.com>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, Vladimir Oltean <vladimir.oltean@nxp.com>, Ioana Ciornei <ioana.ciornei@nxp.com>, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Jose Abreu <joabreu@synopsys.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Giuseppe Cavallaro <peppe.cavallaro@st.com>, Simon Horman <simon.horman@corigine.com> Subject: [PATCH net-next v3 1/5] net: altera-tse: Initialize the regmap_config struct before using it Date: Tue, 6 Jun 2023 17:24:57 +0200 Message-Id: <20230606152501.328789-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606152501.328789-1-maxime.chevallier@bootlin.com> References: <20230606152501.328789-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767969812316587001?= X-GMAIL-MSGID: =?utf-8?q?1767969812316587001?= |
Series |
Followup fixes for the dwmac and altera lynx conversion
|
|
Commit Message
Maxime Chevallier
June 6, 2023, 3:24 p.m. UTC
The regmap_config needs to be zeroed before using it. This will cause
spurious errors at probe time as config->pad_bits is containing random
uninitialized data.
Fixes: db48abbaa18e ("net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V2->V3 : No changes
V1->V2 : No changes
drivers/net/ethernet/altera/altera_tse_main.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Tue, Jun 06, 2023 at 05:24:57PM +0200, Maxime Chevallier wrote: > The regmap_config needs to be zeroed before using it. This will cause > spurious errors at probe time as config->pad_bits is containing random > uninitialized data. > > Fixes: db48abbaa18e ("net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx") > Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> > --- > V2->V3 : No changes > V1->V2 : No changes > > drivers/net/ethernet/altera/altera_tse_main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c > index d866c0f1b503..df509abcd378 100644 > --- a/drivers/net/ethernet/altera/altera_tse_main.c > +++ b/drivers/net/ethernet/altera/altera_tse_main.c > @@ -1255,6 +1255,7 @@ static int altera_tse_probe(struct platform_device *pdev) > if (ret) > goto err_free_netdev; > > + memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg)); i think it would be good to zero out mrc as well - in future someone might expand this struct and you will have the same bug as you're fixing here. > /* SGMII PCS address space. The location can vary depending on how the > * IP is integrated. We can have a resource dedicated to it at a specific > * address space, but if it's not the case, we fallback to the mdiophy0 > -- > 2.40.1 > >
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index d866c0f1b503..df509abcd378 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -1255,6 +1255,7 @@ static int altera_tse_probe(struct platform_device *pdev) if (ret) goto err_free_netdev; + memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg)); /* SGMII PCS address space. The location can vary depending on how the * IP is integrated. We can have a resource dedicated to it at a specific * address space, but if it's not the case, we fallback to the mdiophy0