[PATCH] clk: scpi: pass child node to of_clk_del_provider() in remove

Stepan Ionichev posted 1 patch 1 month ago
drivers/clk/clk-scpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] clk: scpi: pass child node to of_clk_del_provider() in remove
Posted by Stepan Ionichev 1 month ago
scpi_clocks_remove() iterates over the SCPI clock provider's child
device nodes, but passes the parent node to of_clk_del_provider()
on every iteration:

	for_each_available_child_of_node(np, child)
		of_clk_del_provider(np);

Providers are registered per-child in scpi_clk_add() (via
of_clk_add_hw_provider(np, ...) where the np argument is the
child node passed in from probe). of_clk_del_provider() looks up
the entry by node equality, so a call with the parent never
matches and silently does nothing.

This leaks the struct of_clk_provider allocations and the
of_node_get() references the helper takes for every registered
child, both on module unload and on the probe error path
(scpi_clk_add() failure for child N leaves children 0..N-1
registered).

Pass child to of_clk_del_provider() instead, matching the
pattern used by clk-stm32mp1.c:2350-2351.

Fixes: cd52c2a4b5c4 ("clk: add support for clocks provided by SCP(System Control Processor)")
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
---
 drivers/clk/clk-scpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c
index 7806569cd..24cee7c9f 100644
--- a/drivers/clk/clk-scpi.c
+++ b/drivers/clk/clk-scpi.c
@@ -258,7 +258,7 @@ static void scpi_clocks_remove(struct platform_device *pdev)
 	}
 
 	for_each_available_child_of_node(np, child)
-		of_clk_del_provider(np);
+		of_clk_del_provider(child);
 }
 
 static int scpi_clocks_probe(struct platform_device *pdev)
-- 
2.43.0
Re: [PATCH] clk: scpi: pass child node to of_clk_del_provider() in remove
Posted by Sudeep Holla 3 weeks, 5 days ago
On Wed, 13 May 2026 14:09:00 +0500, Stepan Ionichev wrote:
> scpi_clocks_remove() iterates over the SCPI clock provider's child
> device nodes, but passes the parent node to of_clk_del_provider()
> on every iteration:
> 
> 	for_each_available_child_of_node(np, child)
> 		of_clk_del_provider(np);
> 
> [...]

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/1] clk: scpi: pass child node to of_clk_del_provider() in remove
      https://git.kernel.org/sudeep.holla/c/b79d9b5747d9
--
Regards,
Sudeep