* [PATCH net] net: qcom/emac: add missed clk_disable_unprepare in error path of emac_clks_phase1_init
@ 2020-08-10 2:57 Wang Hai
2020-08-11 17:37 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wang Hai @ 2020-08-10 2:57 UTC (permalink / raw)
To: timur, davem, kuba; +Cc: linux-kernel, netdev
Fix the missing clk_disable_unprepare() before return
from emac_clks_phase1_init() in the error handling case.
Fixes: b9b17debc69d ("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>
---
drivers/net/ethernet/qualcomm/emac/emac.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 20b1b43a0e39..1166b98d8bb2 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -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 */
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: qcom/emac: add missed clk_disable_unprepare in error path of emac_clks_phase1_init
2020-08-10 2:57 [PATCH net] net: qcom/emac: add missed clk_disable_unprepare in error path of emac_clks_phase1_init Wang Hai
@ 2020-08-11 17:37 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-11 17:37 UTC (permalink / raw)
To: wanghai38; +Cc: timur, kuba, linux-kernel, netdev
From: Wang Hai <wanghai38@huawei.com>
Date: Mon, 10 Aug 2020 10:57:05 +0800
> Fix the missing clk_disable_unprepare() before return
> from emac_clks_phase1_init() in the error handling case.
>
> Fixes: b9b17debc69d ("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>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-11 17:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 2:57 [PATCH net] net: qcom/emac: add missed clk_disable_unprepare in error path of emac_clks_phase1_init Wang Hai
2020-08-11 17:37 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).