* [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst
@ 2022-01-27 12:17 Yuji Ishikawa
2022-01-27 12:17 ` [PATCH 1/1] net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for unexpected speed request Yuji Ishikawa
2022-01-28 14:30 ` [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Yuji Ishikawa @ 2022-01-27 12:17 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev,
linux-arm-kernel, linux-kernel, nobuhiro1.iwamatsu,
yuji2.ishikawa
Function visconti_eth_fix_mac_speed() should not change a register when an unexpected speed value is passed.
Yuji Ishikawa (1):
net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for
unexpected speed request.
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for unexpected speed request.
2022-01-27 12:17 [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst Yuji Ishikawa
@ 2022-01-27 12:17 ` Yuji Ishikawa
2022-01-28 14:30 ` [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yuji Ishikawa @ 2022-01-27 12:17 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev,
linux-arm-kernel, linux-kernel, nobuhiro1.iwamatsu,
yuji2.ishikawa
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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: b38dd98ff8d0 ("net: stmmac: Add Toshiba Visconti SoCs glue driver")
Signed-off-by: Yuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst
2022-01-27 12:17 [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst Yuji Ishikawa
2022-01-27 12:17 ` [PATCH 1/1] net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for unexpected speed request Yuji Ishikawa
@ 2022-01-28 14:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-28 14:30 UTC (permalink / raw)
To: Yuji Ishikawa
Cc: davem, kuba, peppe.cavallaro, alexandre.torgue, joabreu, netdev,
linux-arm-kernel, linux-kernel, nobuhiro1.iwamatsu
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Thu, 27 Jan 2022 21:17:13 +0900 you wrote:
> Function visconti_eth_fix_mac_speed() should not change a register when an unexpected speed value is passed.
>
> Yuji Ishikawa (1):
> net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for
> unexpected speed request.
>
> drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
Here is the summary with links:
- [1/1] net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for unexpected speed request.
https://git.kernel.org/netdev/net/c/928d6fe996f6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-28 14:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 12:17 [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst Yuji Ishikawa
2022-01-27 12:17 ` [PATCH 1/1] net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for unexpected speed request Yuji Ishikawa
2022-01-28 14:30 ` [PATCH 0/1] net: stmmac: dwmac-visconti: Avoid updating hardware register for unexpected speed requst patchwork-bot+netdevbpf
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).