Commit 2467b674 authored by Shawn Lin's avatar Shawn Lin Committed by Heiko Stuebner

clk: rockchip: free memory in error cases when registering clock branches

Add free memeory if rockchip_clk_register_branch fails.

Fixes: a245fecb ("clk: rockchip: add basic infrastructure...")
Signed-off-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
parent 89aa027e
......@@ -70,7 +70,7 @@ static struct clk *rockchip_clk_register_branch(const char *name,
if (gate_offset >= 0) {
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
if (!gate)
return ERR_PTR(-ENOMEM);
goto err_gate;
gate->flags = gate_flags;
gate->reg = base + gate_offset;
......@@ -82,7 +82,7 @@ static struct clk *rockchip_clk_register_branch(const char *name,
if (div_width > 0) {
div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
return ERR_PTR(-ENOMEM);
goto err_div;
div->flags = div_flags;
div->reg = base + muxdiv_offset;
......@@ -100,6 +100,11 @@ static struct clk *rockchip_clk_register_branch(const char *name,
flags);
return clk;
err_div:
kfree(gate);
err_gate:
kfree(mux);
return ERR_PTR(-ENOMEM);
}
struct rockchip_clk_frac {
......
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