[3.19.y-ckt stable] Patch "clk: rockchip: free memory in error cases when registering clock branches" has been added to the 3.19.y-ckt tree
Kamal Mostafa
kamal at canonical.com
Sat Apr 2 00:51:29 UTC 2016
This is a note to let you know that I have just added a patch titled
clk: rockchip: free memory in error cases when registering clock branches
to the linux-3.19.y-queue branch of the 3.19.y-ckt extended stable tree
which can be found at:
http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.19.y-queue
This patch is scheduled to be released in version 3.19.8-ckt18.
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.19.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Kamal
---8<------------------------------------------------------------
>From 48bd10b3728fde52304d86d8363723355a19039c Mon Sep 17 00:00:00 2001
From: Shawn Lin <shawn.lin at rock-chips.com>
Date: Tue, 2 Feb 2016 11:37:50 +0800
Subject: clk: rockchip: free memory in error cases when registering clock
branches
commit 2467b6745e0ae9c6cdccff24c4cceeb14b1cce3f upstream.
Add free memeory if rockchip_clk_register_branch fails.
Fixes: a245fecbb806 ("clk: rockchip: add basic infrastructure...")
Signed-off-by: Shawn Lin <shawn.lin at rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko at sntech.de>
Signed-off-by: Kamal Mostafa <kamal at canonical.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 20e05bb..fafa540 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);
}
static struct clk *rockchip_clk_register_frac_branch(const char *name,
--
2.7.4
More information about the kernel-team
mailing list