Skip to content
/ linux Public

Commit 6ab68b4

Browse files
iqbalcodes6602gregkh
authored andcommitted
net: dsa: bcm_sf2: fix missing clk_disable_unprepare() in error paths
[ Upstream commit b487318 ] 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. Fixes: e9ec5c3 ("net: dsa: bcm_sf2: request and handle clocks") Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Anas Iqbal <mohd.abd.6602@gmail.com> Link: https://patch.msgid.link/20260318084212.1287-1-mohd.abd.6602@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 719f678 commit 6ab68b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/dsa/bcm_sf2.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,15 +980,19 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
980980
ret = bcm_sf2_sw_rst(priv);
981981
if (ret) {
982982
pr_err("%s: failed to software reset switch\n", __func__);
983+
if (!priv->wol_ports_mask)
984+
clk_disable_unprepare(priv->clk);
983985
return ret;
984986
}
985987

986988
bcm_sf2_crossbar_setup(priv);
987989

988990
ret = bcm_sf2_cfp_resume(ds);
989-
if (ret)
991+
if (ret) {
992+
if (!priv->wol_ports_mask)
993+
clk_disable_unprepare(priv->clk);
990994
return ret;
991-
995+
}
992996
if (priv->hw_params.num_gphy == 1)
993997
bcm_sf2_gphy_enable_set(ds, true);
994998

0 commit comments

Comments
 (0)