From 054ef44ea3ef2883e0f63c9a54c91c07f321a0b4 Mon Sep 17 00:00:00 2001 From: Jian Dong Date: Tue, 23 Mar 2021 11:10:34 +0800 Subject: clk: imx: Reference preceded by free When register failed, clk will be freed, it will generate dangling pointer problem in later reference. it should return directly. Signed-off-by: Jian Dong Signed-off-by: Abel Vesa --- drivers/clk/imx/clk-lpcg-scu.c | 1 + drivers/clk/imx/clk-scu.c | 1 + 2 files changed, 2 insertions(+) (limited to 'drivers/clk/imx') diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c index 77be7632866d..dd5abd09f3e2 100644 --- a/drivers/clk/imx/clk-lpcg-scu.c +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -114,6 +114,7 @@ struct clk_hw *__imx_clk_lpcg_scu(struct device *dev, const char *name, if (ret) { kfree(clk); hw = ERR_PTR(ret); + return hw; } if (dev) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index 1f5518b7ab39..f89b4da10e80 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -426,6 +426,7 @@ struct clk_hw *__imx_clk_scu(struct device *dev, const char *name, if (ret) { kfree(clk); hw = ERR_PTR(ret); + return hw; } if (dev) -- cgit v1.2.3