]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
clk: st: Fix memory leak
authorValentin Ilie <valentin.ilie@gmail.com>
Tue, 22 Apr 2014 13:15:54 +0000 (16:15 +0300)
committerMike Turquette <mturquette@linaro.org>
Fri, 23 May 2014 22:13:32 +0000 (15:13 -0700)
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>
drivers/clk/st/clkgen-pll.c

index bca0a0badbfa68c176aa0e82b663682b53845834..a886702f7c8ba3538ae410be65ba0061ec9d0d96 100644 (file)
@@ -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;