public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths
@ 2026-03-14  8:11 Anas Iqbal
  2026-03-16  7:06 ` Jonas Gorski
  0 siblings, 1 reply; 7+ messages in thread
From: Anas Iqbal @ 2026-03-14  8:11 UTC (permalink / raw)
  To: florian.fainelli, jonas.gorski
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, Anas Iqbal

Smatch reports:
drivers/net/dsa/bcm_sf2.c:997 bcm_sf2_sw_resume() warn:
'priv->clk' from clk_prepare_enable() not released on lines: 983,990.

The clock enabled by clk_prepare_enable() in bcm_sf2_sw_resume()
is not released if bcm_sf2_sw_rst() or bcm_sf2_cfp_resume() fails.

Add the missing clk_disable_unprepare() calls in the error paths
to properly release the clock resource.

Signed-off-by: Anas Iqbal <mohd.abd.6602@gmail.com>
---
 drivers/net/dsa/bcm_sf2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 960685596093..de3efa3ce9a7 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -980,15 +980,19 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
 	ret = bcm_sf2_sw_rst(priv);
 	if (ret) {
 		pr_err("%s: failed to software reset switch\n", __func__);
+		if (!priv->wol_ports_mask)
+			clk_disable_unprepare(priv->clk);
 		return ret;
 	}
 
 	bcm_sf2_crossbar_setup(priv);
 
 	ret = bcm_sf2_cfp_resume(ds);
-	if (ret)
+	if (ret) {
+		if (!priv->wol_ports_mask)
+			clk_disable_unprepare(priv->clk);
 		return ret;
-
+	}
 	if (priv->hw_params.num_gphy == 1)
 		bcm_sf2_gphy_enable_set(ds, true);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-19 16:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14  8:11 [PATCH] net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths Anas Iqbal
2026-03-16  7:06 ` Jonas Gorski
2026-03-16 13:25   ` Anas Iqbal
2026-03-16 23:17     ` Florian Fainelli
2026-03-16 23:56     ` Jakub Kicinski
2026-03-18  8:42   ` [PATCH net v3] " Anas Iqbal
2026-03-19 16:40     ` 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