[PATCH] soc: imx8m: Fix clock leak in imx8m_soc_prepare()
Wentao Liang
vulab at iscas.ac.cn
Thu Sep 17 08:30:12 PDT 2026
When clk_prepare_enable() fails, imx8m_soc_prepare() jumps to err_clk,
which only undoes the iounmap. The reference obtained by
of_clk_get_by_name() is not dropped, and imx8m_soc_probe() returns the
error without calling imx8m_soc_unprepare(), so the clock reference is
leaked.
Release it before leaving the prepare function.
Fixes: 390c01073f5d ("soc: imx8m: Cleanup with adding imx8m_soc_[un]prepare")
Cc: stable at vger.kernel.org
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
drivers/soc/imx/soc-imx8m.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
index 77763a107edb..f4c2d5e37ec7 100644
--- a/drivers/soc/imx/soc-imx8m.c
+++ b/drivers/soc/imx/soc-imx8m.c
@@ -149,8 +149,10 @@ static int imx8m_soc_prepare(struct platform_device *pdev, const char *ocotp_com
}
ret = clk_prepare_enable(drvdata->clk);
- if (ret)
+ if (ret) {
+ clk_put(drvdata->clk);
goto err_clk;
+ }
return 0;
--
2.34.1
More information about the linux-arm-kernel
mailing list