diff options
author | Ray Jui <rjui@broadcom.com> | 2015-06-29 23:30:09 +0200 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-07-02 18:50:26 +0200 |
commit | 45a481c2176f6acca2efb6477c6018b2c3e3c60f (patch) | |
tree | e1e873a19c6e582f1efe0a36fd7444584364c7e7 /drivers/clk/bcm/clk-iproc-asiu.c | |
parent | clk: stm32: Add clock driver for STM32F4[23]xxx devices (diff) | |
download | linux-45a481c2176f6acca2efb6477c6018b2c3e3c60f.tar.xz linux-45a481c2176f6acca2efb6477c6018b2c3e3c60f.zip |
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.c | 6 |
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: |