Skip to content

Commit

Permalink
clk: qoriq: fix memory leak
Browse files Browse the repository at this point in the history
If get_pll_div() fails we exited by returning NULL but we missed
releasing hwc.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Fixes: 0dfc86b ("clk: qoriq: Move chip-specific knowledge into driver")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
  • Loading branch information
Sudip Mukherjee authored and Stephen Boyd committed Nov 30, 2015
1 parent 0d2681e commit 279104e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/clk/clk-qoriq.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,10 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
*/
clksel = (cg_in(cg, hwc->reg) & CLKSEL_MASK) >> CLKSEL_SHIFT;
div = get_pll_div(cg, hwc, clksel);
if (!div)
if (!div) {
kfree(hwc);
return NULL;
}

pct80_rate = clk_get_rate(div->clk);
pct80_rate *= 8;
Expand Down

0 comments on commit 279104e

Please sign in to comment.