linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]  clk: imx: reference preceded by free
@ 2021-03-23  3:10 Jian Dong
  2021-03-30  9:17 ` Abel Vesa
  2021-03-31  2:16 ` Stephen Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Jian Dong @ 2021-03-23  3:10 UTC (permalink / raw)
  To: abel.vesa, mturquette, sboyd, shawnguo, s.hauer
  Cc: linux-imx, linux-clk, linux-arm-kernel, linux-kernel, huyue2, Jian Dong

From: Jian Dong <dongjian@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@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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-08  7:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23  3:10 [PATCH] clk: imx: reference preceded by free Jian Dong
2021-03-30  9:17 ` Abel Vesa
2021-03-31  2:16 ` Stephen Boyd
2021-04-08  1:53   ` Jian Dong
2021-04-08  7:41     ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).