Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp15064pxb; Thu, 27 Jan 2022 13:58:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz59+xAZ0NtCuRrnG7TI+Rskw+OqbHRworeOrbPGUa3yyZCRqT727hl5OZGBzSlFiw7EZHF X-Received: by 2002:a17:906:5d12:: with SMTP id g18mr4266236ejt.745.1643320726534; Thu, 27 Jan 2022 13:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643320726; cv=none; d=google.com; s=arc-20160816; b=yN1s5RRX/OBXGeArZhrUqiz5tdMyZmH2v/cq53HZPArZMdp+prbkObZxS0CwatCnx6 xUMUBjMArqWl6r9SjPi8fU4wSD9vRgi875xIXGngzqrvOhpL5m2tIclL8hCbFyGU14O3 zq8fZZWxfSwvoILZjTXocLGSR9c7YU7E9V1tLrahpu1wAKDSaBxfhNsZGFJVfNM9FnPG vHYbtzfikIG3Ai04n3Y9A6Z+JgbtlV4HR315qNsO25AbZcJrktSE8djNaFIqlT6pk/0D FDjaA4fEhdKGuDJicF7E6FpNv/J6xnpLjEYW7c2yV4/vh76cyibVimdCuELzE5uZBZ26 C1VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=t3xGdrGxAfLcfEfPmZlYp3IbvIFJj4aAoDj3x8JIODU=; b=NRmn2wMah9JDwOM44O93UKf9EFcz39m50xFmU9cFbqAVB9RJXeP8DY70baNsrve6DQ H0MDUL3lft/bW8X+10Vk2QSo6B6vYNT42AupOWOT9OwZf9ZYCDboKPHyWJQ4/XPV7K/j yas5ognBkSIB3iyrT8q2uc3fk+OFUL+8DWVsHpk3cWfW0NxW+lKaqZPZxqJVZwyr9/4k iqzsZtY4bbRXyNzThAPpIRmby8AVL9sf4QM4lOwVoMjablhjg5ffLju1jcycL0PP6k5O t8wPvLxbjiw7fZBAYvC1Ij4zlWAvMbUzkKDBbLGH+e/z/ejCc5GZYFtMF+bGd8hDzEl9 v6HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si1829917edr.91.2022.01.27.13.58.22; Thu, 27 Jan 2022 13:58:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241132AbiA0MXG (ORCPT + 99 others); Thu, 27 Jan 2022 07:23:06 -0500 Received: from mo-csw1515.securemx.jp ([210.130.202.154]:33302 "EHLO mo-csw.securemx.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231201AbiA0MXE (ORCPT ); Thu, 27 Jan 2022 07:23:04 -0500 Received: by mo-csw.securemx.jp (mx-mo-csw1515) id 20RCMcX0031508; Thu, 27 Jan 2022 21:22:38 +0900 X-Iguazu-Qid: 34tKV35MdxK8a3pfYA X-Iguazu-QSIG: v=2; s=0; t=1643286157; q=34tKV35MdxK8a3pfYA; m=+h4MiUkJTIU1g/JRnWIqS9O3kEafgLfrraUtYVNfhc8= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1513) id 20RCMaJT006582 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 27 Jan 2022 21:22:36 +0900 X-SA-MID: 31148933 From: Yuji Ishikawa To: "David S . Miller" , Jakub Kicinski Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nobuhiro1.iwamatsu@toshiba.co.jp, yuji2.ishikawa@toshiba.co.jp Subject: [PATCH 1/1] net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for unexpected speed request. Date: Thu, 27 Jan 2022 21:17:14 +0900 X-TSB-HOP: ON X-TSB-HOP2: ON Message-Id: <20220127121714.22915-2-yuji2.ishikawa@toshiba.co.jp> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220127121714.22915-1-yuji2.ishikawa@toshiba.co.jp> References: <20220127121714.22915-1-yuji2.ishikawa@toshiba.co.jp> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Variable clk_sel_val is not initialized in the default case of the first switch statement. In that case, the function should return immediately without any changes to the hardware. Reported-by: kernel test robot Reported-by: Dan Carpenter Fixes: b38dd98ff8d0 ("net: stmmac: Add Toshiba Visconti SoCs glue driver") Signed-off-by: Yuji Ishikawa Reviewed-by: Nobuhiro Iwamatsu --- drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c index dde5b772a..c3f10a92b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c @@ -49,13 +49,15 @@ struct visconti_eth { void __iomem *reg; u32 phy_intf_sel; struct clk *phy_ref_clk; + struct device *dev; spinlock_t lock; /* lock to protect register update */ }; static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) { struct visconti_eth *dwmac = priv; - unsigned int val, clk_sel_val; + struct net_device *netdev = dev_get_drvdata(dwmac->dev); + unsigned int val, clk_sel_val = 0; unsigned long flags; spin_lock_irqsave(&dwmac->lock, flags); @@ -85,7 +87,9 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) break; default: /* No bit control */ - break; + netdev_err(netdev, "Unsupported speed request (%d)", speed); + spin_unlock_irqrestore(&dwmac->lock, flags); + return; } writel(val, dwmac->reg + MAC_CTRL_REG); @@ -229,6 +233,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) spin_lock_init(&dwmac->lock); dwmac->reg = stmmac_res.addr; + dwmac->dev = &pdev->dev; plat_dat->bsp_priv = dwmac; plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed; -- 2.17.1