diff options
author | Valentin Ilie <valentin.ilie@gmail.com> | 2014-04-22 15:15:54 +0200 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-05-24 00:13:32 +0200 |
commit | 72b1c2c3a4de8891b06df18da95514d69eae65de (patch) | |
tree | 2a7838ec6d42f16d49ad0d7ac00e58fe1a9a2900 /drivers/clk/st | |
parent | clk: divider: Fix table round up function (diff) | |
download | linux-72b1c2c3a4de8891b06df18da95514d69eae65de.tar.xz linux-72b1c2c3a4de8891b06df18da95514d69eae65de.zip |
clk: st: Fix memory leak
When it fails to allocate div, gate should be free'd before return
Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/st')
-rw-r--r-- | drivers/clk/st/clkgen-pll.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c index bca0a0badbfa..a886702f7c8b 100644 --- a/drivers/clk/st/clkgen-pll.c +++ b/drivers/clk/st/clkgen-pll.c @@ -521,8 +521,10 @@ static struct clk * __init clkgen_odf_register(const char *parent_name, gate->lock = odf_lock; div = kzalloc(sizeof(*div), GFP_KERNEL); - if (!div) + if (!div) { + kfree(gate); return ERR_PTR(-ENOMEM); + } div->flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO; div->reg = reg + pll_data->odf[odf].offset; |