diff options
author | Ray Jui <rjui@broadcom.com> | 2015-06-29 14:30:09 -0700 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-07-02 09:50:26 -0700 |
commit | 45a481c2176f6acca2efb6477c6018b2c3e3c60f (patch) | |
tree | e1e873a19c6e582f1efe0a36fd7444584364c7e7 /drivers/clk/bcm/clk-iproc-pll.c | |
parent | 358bdf892f6bfacf20884b54a35ab038321f06f9 (diff) | |
download | op-kernel-dev-45a481c2176f6acca2efb6477c6018b2c3e3c60f.zip op-kernel-dev-45a481c2176f6acca2efb6477c6018b2c3e3c60f.tar.gz |
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.c | 8 |
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 46fb84b..a8d971b 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) |