提交 72b1c2c3 编写于 作者: V Valentin Ilie 提交者: Mike Turquette

clk: st: Fix memory leak

When it fails to allocate div, gate should be free'd before return
Signed-off-by: NValentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: NMike Turquette <mturquette@linaro.org>
上级 fe52e750
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册