[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251126032534.1628-1-vulab@iscas.ac.cn>
Date: Wed, 26 Nov 2025 11:25:34 +0800
From: Haotian Zhang <vulab@...as.ac.cn>
To: kernel@...il.dk,
hal.feng@...rfivetech.com,
mturquette@...libre.com,
sboyd@...nel.org
Cc: linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org,
Haotian Zhang <vulab@...as.ac.cn>
Subject: [PATCH] clk: starfive: jh7110-sys: Use devm_clk_notifier_register()
The clk_notifier_register() in jh7110_syscrg_probe() is not unregistered
in the error path, leading to a resource leak and potential use-after-free
if probe fails after the notifier is registered.
Use devm_clk_notifier_register() instead to automatically unregister
the notifier.
Fixes: 538d5477b252 ("clk: starfive: jh7110-sys: Add notifier for PLL0 clock")
Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
---
drivers/clk/starfive/clk-starfive-jh7110-sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c
index 52833d4241c5..4f915038bd4b 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c
@@ -430,7 +430,7 @@ static int __init jh7110_syscrg_probe(struct platform_device *pdev)
return PTR_ERR(priv->pll[0]);
} else {
priv->pll_clk_nb.notifier_call = jh7110_pll0_clk_notifier_cb;
- ret = clk_notifier_register(pllclk, &priv->pll_clk_nb);
+ ret = devm_clk_notifier_register(priv->dev, pllclk, &priv->pll_clk_nb);
if (ret)
return ret;
priv->pll[0] = NULL;
--
2.50.1.windows.1
Powered by blists - more mailing lists