Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72b1c2c3 authored by Valentin Ilie's avatar Valentin Ilie Committed by Mike Turquette
Browse files

clk: st: Fix memory leak



When it fails to allocate div, gate should be free'd before return

Signed-off-by: default avatarValentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
parent fe52e750
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;