clk: versatile-icst: fix memory leak
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 23 Oct 2015 09:36:01 +0000 (11:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Dec 2015 19:03:20 +0000 (14:03 -0500)
commit 7bdccef34fc67d3fce6778a018601dd41e43c5ce upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/clk/versatile/clk-icst.c

index bc96f10..9064636 100644 (file)
@@ -156,8 +156,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;
 }