summaryrefslogtreecommitdiff
path: root/drivers/clk/bcm/clk-iproc-pll.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-pll.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-pll.c')
-rw-r--r--drivers/clk/bcm/clk-iproc-pll.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c
index 46fb84bc2674..a8d971b820b0 100644
--- a/drivers/clk/bcm/clk-iproc-pll.c
+++ b/drivers/clk/bcm/clk-iproc-pll.c
@@ -655,10 +655,6 @@ void __init iproc_pll_clk_setup(struct device_node *node,
memset(&init, 0, sizeof(init));
parent_name = node->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))
@@ -690,10 +686,8 @@ void __init iproc_pll_clk_setup(struct device_node *node,
return;
err_clk_register:
- for (i = 0; i < num_clks; i++) {
- kfree(pll->clks[i].name);
+ for (i = 0; i < num_clks; i++)
clk_unregister(pll->clk_data.clks[i]);
- }
err_pll_register:
if (pll->asiu_base)