net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths
PATCH 1/1 net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths
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.
--- drivers/net/dsa/bcm_sf2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/dsa/bcm_sf2.c +6 -2
@@ -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);
Signature · 1 line
2.43.0
Quoted 5 lines · Anas Iqbal
Smatch reports:
drivers/net/dsa/bcm_sf2.c:997bcm_sf2_sw_resume()warn:
'priv->clk' fromclk_prepare_enable()not released on lines: 983,990.
Quoted 7 lines
The clock enabled by
clk_prepare_enable()inbcm_sf2_sw_resume()is not released ifbcm_sf2_sw_rst()orbcm_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 <[email protected]>
It's a fix, so it should have Fixes tag, e.g.
apart from that
PATCH 1/1 net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths
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.
v2:
- Add Fixes tag as suggested by Jonas Gorski
--- drivers/net/dsa/bcm_sf2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/dsa/bcm_sf2.c +6 -2
@@ -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);
Signature · 1 line
2.43.0
Quoted 7 lines · Anas Iqbal
Smatch reports:
drivers/net/dsa/bcm_sf2.c:997bcm_sf2_sw_resume()warn:
'priv->clk' fromclk_prepare_enable()not released on lines: 983,990.The clock enabled by
clk_prepare_enable()inbcm_sf2_sw_resume()is not released ifbcm_sf2_sw_rst()orbcm_sf2_cfp_resume()fails.
Quoted 6 lines
Add the missing
clk_disable_unprepare()calls in the error paths to properly release the clock resource.Fixes e9ec5c3bd238 ("net: dsa: bcm_sf2: request and handle clocks")Reviewed-by Jonas Gorski <[email protected]>Signed-off-by Anas Iqbal <[email protected]>
Subject should be "PATCH net", and you would want to wait 24 hrs before re-submitting, with that:
Signature · 1 line
Florian
Jakub Kicinski
maintainerQuoted 3 lines · On Mon, 16 Mar 2026 13:25:47 +0000 Anas Iqbal wrote:
Reviewed-by Jonas Gorski <[email protected]>Signed-off-by Anas Iqbal <[email protected]>
replace this empty line with a --- when you repost That way git will cut off the change log when patch is applied, which is what we want.
Quoted 2 lines
v2:
- Add Fixes tag as suggested by Jonas Gorski
Signature · 1 line
pw-bot: cr
PATCH v3 1/1 net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths
In reply to Jonas GorskiSmatch 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.
---
v3:
- Add Fixes tag as suggested by Jonas Gorski
- Add Reviewed-by from Florian Fainelli
- Add proper separator (---) for changelog
--- drivers/net/dsa/bcm_sf2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/dsa/bcm_sf2.c +6 -2
@@ -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);
Signature · 1 line
2.43.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 18 Mar 2026 08:42:12 +0000 you wrote:
Smatch reports:
drivers/net/dsa/bcm_sf2.c:997bcm_sf2_sw_resume()warn:
'priv->clk' fromclk_prepare_enable()not released on lines: 983,990.The clock enabled by
clk_prepare_enable()inbcm_sf2_sw_resume()is not released ifbcm_sf2_sw_rst()orbcm_sf2_cfp_resume()fails.[...]
Here is the summary with links:
- [net,v3] net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths
https://git.kernel.org/netdev/net/c/b48731849609
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html