Commit 282312d1 authored by Shawn Lin's avatar Shawn Lin Committed by Heiko Stuebner

clk: rockchip: disable alt_parent clk in err cases when registering cpuclk

Add clk_disable_unprepare to handle cpuclk->alt_parent if
rockchip_clk_register_cpuclk fails.
Signed-off-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
parent 36714529
...@@ -290,14 +290,14 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, ...@@ -290,14 +290,14 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
pr_err("%s: could not lookup parent clock %s\n", pr_err("%s: could not lookup parent clock %s\n",
__func__, parent_names[0]); __func__, parent_names[0]);
ret = -EINVAL; ret = -EINVAL;
goto free_cpuclk; goto free_alt_parent;
} }
ret = clk_notifier_register(clk, &cpuclk->clk_nb); ret = clk_notifier_register(clk, &cpuclk->clk_nb);
if (ret) { if (ret) {
pr_err("%s: failed to register clock notifier for %s\n", pr_err("%s: failed to register clock notifier for %s\n",
__func__, name); __func__, name);
goto free_cpuclk; goto free_alt_parent;
} }
if (nrates > 0) { if (nrates > 0) {
...@@ -326,6 +326,8 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, ...@@ -326,6 +326,8 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
kfree(cpuclk->rate_table); kfree(cpuclk->rate_table);
unregister_notifier: unregister_notifier:
clk_notifier_unregister(clk, &cpuclk->clk_nb); clk_notifier_unregister(clk, &cpuclk->clk_nb);
free_alt_parent:
clk_disable_unprepare(cpuclk->alt_parent);
free_cpuclk: free_cpuclk:
kfree(cpuclk); kfree(cpuclk);
return ERR_PTR(ret); return ERR_PTR(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment