[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251113134009.79440-1-Pavel.Zhigulin@kaspersky.com>
Date: Thu, 13 Nov 2025 16:40:07 +0300
From: Pavel Zhigulin <Pavel.Zhigulin@...persky.com>
To: Andrew Lunn <andrew+netdev@...n.ch>
CC: Pavel Zhigulin <Pavel.Zhigulin@...persky.com>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Maxime Coquelin
<mcoquelin.stm32@...il.com>, Alexandre Torgue <alexandre.torgue@...s.st.com>,
Maxime Chevallier <maxime.chevallier@...tlin.com>, Inochi Amaoto
<inochiama@...il.com>, Quentin Schulz <quentin.schulz@...rry.de>, Joe Hattori
<joe@...is.s.u-tokyo.ac.jp>, Rayagond Kokatanur <rayagond@...avyalabs.com>,
Giuseppe CAVALLARO <peppe.cavallaro@...com>, <netdev@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<lvc-project@...uxtesting.org>
Subject: [PATCH net] net: stmmac: add clk_prepare_enable() error handling
The driver previously ignored the return value of 'clk_prepare_enable()'
for both the CSR clock and the PCLK in 'stmmac_probe_config_dt()' function.
Add 'clk_prepare_enable()' return value checks.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: bfab27a146ed ("stmmac: add the experimental PCI support")
Signed-off-by: Pavel Zhigulin <Pavel.Zhigulin@...persky.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 27bcaae07a7f..042d542b9c65 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -632,7 +632,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
dev_warn(&pdev->dev, "Cannot get CSR clock\n");
plat->stmmac_clk = NULL;
}
- clk_prepare_enable(plat->stmmac_clk);
+ rc = clk_prepare_enable(plat->stmmac_clk);
+ if (rc < 0)
+ dev_warn(&pdev->dev, "Cannot enable CSR clock: %d\n", rc);
}
plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
@@ -640,7 +642,11 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
ret = plat->pclk;
goto error_pclk_get;
}
- clk_prepare_enable(plat->pclk);
+ rc = clk_prepare_enable(plat->pclk);
+ if (rc < 0) {
+ dev_err(&pdev->dev, "Cannot enable pclk: %d\n", rc);
+ goto error_pclk_get;
+ }
/* Fall-back to main clock in case of no PTP ref is passed */
plat->clk_ptp_ref = devm_clk_get(&pdev->dev, "ptp_ref");
--
2.43.0
Powered by blists - more mailing lists