ARM i.MX: fix error-valued pointer dereference in clk_register_gate2()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 25 Oct 2012 15:02:18 +0000 (23:02 +0800)
committerSascha Hauer <s.hauer@pengutronix.de>
Fri, 16 Nov 2012 14:53:57 +0000 (15:53 +0100)
The error-valued pointer clk is used for the arg of kfree, it should be
kfree(gate) if clk_register() return ERR_PTR().

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-imx/clk-gate2.c

index 3c1b8ff9a0a61c24f2e7d6647a62168cd8a7e146..cc49c7ae186ed2bc0d3519bf7648a153ddb45d55 100644 (file)
@@ -112,7 +112,7 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
 
        clk = clk_register(dev, &gate->hw);
        if (IS_ERR(clk))
-               kfree(clk);
+               kfree(gate);
 
        return clk;
 }