summaryrefslogtreecommitdiff
path: root/drivers/clk/bcm/clk-iproc-asiu.c
diff options
context:
space:
mode:
authorRay Jui <rjui@broadcom.com>2015-06-30 00:30:09 +0300
committerStephen Boyd <sboyd@codeaurora.org>2015-07-02 19:50:26 +0300
commit45a481c2176f6acca2efb6477c6018b2c3e3c60f (patch)
treee1e873a19c6e582f1efe0a36fd7444584364c7e7 /drivers/clk/bcm/clk-iproc-asiu.c
parent358bdf892f6bfacf20884b54a35ab038321f06f9 (diff)
downloadlinux-45a481c2176f6acca2efb6477c6018b2c3e3c60f.tar.xz
clk: iproc: fix memory leak from clock name
of_property_read_string_index takes array of pointers and assign them to strings read from device tree property. No additional memory allocation is needed prior to calling of_property_read_string_index. In fact, since the array of pointers will be re-assigned to other strings, any memory that it points to prior to calling of_property_read_string_index will be leaked Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ray Jui <rjui@broadcom.com> Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/bcm/clk-iproc-asiu.c')
-rw-r--r--drivers/clk/bcm/clk-iproc-asiu.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/clk/bcm/clk-iproc-asiu.c b/drivers/clk/bcm/clk-iproc-asiu.c
index e19c09cd9645..f630e1bbdcfe 100644
--- a/drivers/clk/bcm/clk-iproc-asiu.c
+++ b/drivers/clk/bcm/clk-iproc-asiu.c
@@ -222,10 +222,6 @@ void __init iproc_asiu_setup(struct device_node *node,
struct iproc_asiu_clk *asiu_clk;
const char *clk_name;
- clk_name = kzalloc(IPROC_CLK_NAME_LEN, GFP_KERNEL);
- if (WARN_ON(!clk_name))
- goto err_clk_register;
-
ret = of_property_read_string_index(node, "clock-output-names",
i, &clk_name);
if (WARN_ON(ret))
@@ -259,7 +255,7 @@ void __init iproc_asiu_setup(struct device_node *node,
err_clk_register:
for (i = 0; i < num_clks; i++)
- kfree(asiu->clks[i].name);
+ clk_unregister(asiu->clk_data.clks[i]);
iounmap(asiu->gate_base);
err_iomap_gate: