clk: versatile-icst: fix memory leak
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 23 Oct 2015 09:36:01 +0000 (11:36 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Fri, 23 Oct 2015 20:34:53 +0000 (13:34 -0700)
A static code checker found a memory leak in the Versatile
ICST code. Fix it.

Fixes: a183da637c52 "clk: versatile: respect parent rate in ICST clock"
Reported-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/versatile/clk-icst.c

index a3893ea2199dafa5412207711a1d33fca04c287f..08c5ee976879932ab2dfc48d41391a6836942526 100644 (file)
@@ -157,8 +157,10 @@ struct clk *icst_clk_register(struct device *dev,
        icst->lockreg = base + desc->lock_offset;
 
        clk = clk_register(dev, &icst->hw);
-       if (IS_ERR(clk))
+       if (IS_ERR(clk)) {
+               kfree(pclone);
                kfree(icst);
+       }
 
        return clk;
 }