Skip to content

Commit

Permalink
net: qcom/emac: add missed clk_disable_unprepare in error path of ema…
Browse files Browse the repository at this point in the history
…c_clks_phase1_init

Fix the missing clk_disable_unprepare() before return
from emac_clks_phase1_init() in the error handling case.

Fixes: b9b17de ("net: emac: emac gigabit ethernet controller driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Acked-by: Timur Tabi <timur@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wang Hai authored and davem330 committed Aug 11, 2020
1 parent e716420 commit 50caa77
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions drivers/net/ethernet/qualcomm/emac/emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,24 @@ static int emac_clks_phase1_init(struct platform_device *pdev,

ret = clk_prepare_enable(adpt->clk[EMAC_CLK_CFG_AHB]);
if (ret)
return ret;
goto disable_clk_axi;

ret = clk_set_rate(adpt->clk[EMAC_CLK_HIGH_SPEED], 19200000);
if (ret)
return ret;
goto disable_clk_cfg_ahb;

ret = clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]);
if (ret)
goto disable_clk_cfg_ahb;

return clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]);
return 0;

disable_clk_cfg_ahb:
clk_disable_unprepare(adpt->clk[EMAC_CLK_CFG_AHB]);
disable_clk_axi:
clk_disable_unprepare(adpt->clk[EMAC_CLK_AXI]);

return ret;
}

/* Enable clocks; needs emac_clks_phase1_init to be called before */
Expand Down

0 comments on commit 50caa77

Please sign in to comment.