Skip to content

Commit

Permalink
clk: rockchip: disable alt_parent clk in err cases when registering c…
Browse files Browse the repository at this point in the history
…puclk

Add clk_disable_unprepare to handle cpuclk->alt_parent if
rockchip_clk_register_cpuclk fails.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
  • Loading branch information
Shawn Lin authored and Heiko Stuebner committed Feb 15, 2016
1 parent 3671452 commit 282312d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/clk/rockchip/clk-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
pr_err("%s: could not lookup parent clock %s\n",
__func__, parent_names[0]);
ret = -EINVAL;
goto free_cpuclk;
goto free_alt_parent;
}

ret = clk_notifier_register(clk, &cpuclk->clk_nb);
if (ret) {
pr_err("%s: failed to register clock notifier for %s\n",
__func__, name);
goto free_cpuclk;
goto free_alt_parent;
}

if (nrates > 0) {
Expand Down Expand Up @@ -326,6 +326,8 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
kfree(cpuclk->rate_table);
unregister_notifier:
clk_notifier_unregister(clk, &cpuclk->clk_nb);
free_alt_parent:
clk_disable_unprepare(cpuclk->alt_parent);
free_cpuclk:
kfree(cpuclk);
return ERR_PTR(ret);
Expand Down

0 comments on commit 282312d

Please sign in to comment.