[PATCH] clk: imx: reference preceded by free
Jian Dong
dj0227 at 163.com
Tue Mar 23 03:10:34 GMT 2021
From: Jian Dong <dongjian at yulong.com>
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 <dongjian at yulong.com>
---
drivers/clk/imx/clk-lpcg-scu.c | 1 +
drivers/clk/imx/clk-scu.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c
index 77be763..dd5abd0 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 1f5518b7..f89b4da 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)
--
1.9.1
More information about the linux-arm-kernel
mailing list