diff options
author | Valentin Ilie <valentin.ilie@gmail.com> | 2014-04-22 16:15:54 +0300 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-05-23 15:13:32 -0700 |
commit | 72b1c2c3a4de8891b06df18da95514d69eae65de (patch) | |
tree | 2a7838ec6d42f16d49ad0d7ac00e58fe1a9a2900 /drivers/clk/st | |
parent | fe52e7505f8bf365d5ab0eeee19ababe406cbaaf (diff) | |
download | op-kernel-dev-72b1c2c3a4de8891b06df18da95514d69eae65de.zip op-kernel-dev-72b1c2c3a4de8891b06df18da95514d69eae65de.tar.gz |
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 bca0a0b..a886702 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; |