* [PATCH] clk: rockchip: free memory for error handle
@ 2016-02-02 3:37 Shawn Lin
2016-02-02 21:11 ` Heiko Stübner
0 siblings, 1 reply; 2+ messages in thread
From: Shawn Lin @ 2016-02-02 3:37 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Heiko Stuebner
Cc: linux-clk, linux-kernel, linux-rockchip, Shawn Lin
Add free memeory if rockchip_clk_register_branch
failed.
Fixes: a245fecbb806 ("clk: rockchip: add basic infrastructure...")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/clk/rockchip/clk.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index d9a0b5d..62fbe2c 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -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 {
--
2.3.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: rockchip: free memory for error handle
2016-02-02 3:37 [PATCH] clk: rockchip: free memory for error handle Shawn Lin
@ 2016-02-02 21:11 ` Heiko Stübner
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stübner @ 2016-02-02 21:11 UTC (permalink / raw)
To: Shawn Lin
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel, linux-rockchip
Am Dienstag, 2. Februar 2016, 11:37:50 schrieb Shawn Lin:
> Add free memeory if rockchip_clk_register_branch
> failed.
>
> Fixes: a245fecbb806 ("clk: rockchip: add basic infrastructure...")
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
applied to my clk-branch for 4.6
Thanks
Heiko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-02 21:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 3:37 [PATCH] clk: rockchip: free memory for error handle Shawn Lin
2016-02-02 21:11 ` Heiko Stübner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.