Skip to content

Commit b487318

Browse files
iqbalcodes6602kuba-moo
authored andcommitted
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. Fixes: e9ec5c3 ("net: dsa: bcm_sf2: request and handle clocks") Reviewed-by: Jonas Gorski <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Anas Iqbal <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e7577a0 commit b487318

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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)