clk: rk808: fix OF node reference imbalance
Subsystems (2)
PATCH 1/1 clk: rk808: fix OF node reference imbalance
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Fix this by using the intended helper for reusing OF nodes.
--- drivers/clk/clk-rk808.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-rk808.c +1 -1
@@ -153,7 +153,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)struct rk808_clkout *rk808_clkout;int ret; - dev->of_node = pdev->dev.parent->of_node; +device_set_of_node_from_dev (dev, dev->parent); rk808_clkout =devm_kzalloc (dev,sizeof (*rk808_clkout),GFP_KERNEL );
Signature · 1 line
2.52.0
Hi,
Quoted 5 lines · Johan Hovold
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Quoted 7 lines
Fix this by using the intended helper for reusing OF nodes.
Fixes 2dc51ca822e4 ("clk: RK808: Reduce 'struct rk808' usage")Cc [email protected] # 6.5Cc Sebastian Reichel <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
Greetings,
-- Sebastian
Quoted 19 lines
drivers/clk/clk-rk808.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/clk-rk808.c +1
-1@@ -153,7 +153,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)struct rk808_clkout *rk808_clkout;int ret; - dev->of_node = pdev->dev.parent->of_node; +device_set_of_node_from_dev (dev, dev->parent); rk808_clkout =devm_kzalloc (dev,sizeof (*rk808_clkout),GFP_KERNEL );Signature · 1 line
2.52.0
Quoted 11 lines · Johan Hovold
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Fix this by using the intended helper for reusing OF nodes.
Fixes 2dc51ca822e4 ("clk: RK808: Reduce 'struct rk808' usage")Cc [email protected] # 6.5Cc Sebastian Reichel <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Stephen Boyd
maintainerQuoting Johan Hovold (2026-04-07 02:50:27)
Quoted 5 lines
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Quoted 7 lines
Fix this by using the intended helper for reusing OF nodes.
Fixes 2dc51ca822e4 ("clk: RK808: Reduce 'struct rk808' usage")Cc [email protected] # 6.5Cc Sebastian Reichel <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
+Heiko
Quoted 19 lines
drivers/clk/clk-rk808.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/clk-rk808.c +1
-1@@ -153,7 +153,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)struct rk808_clkout *rk808_clkout;int ret; - dev->of_node = pdev->dev.parent->of_node; +device_set_of_node_from_dev (dev, dev->parent); rk808_clkout =devm_kzalloc (dev,sizeof (*rk808_clkout),GFP_KERNEL );Signature · 1 line
2.52.0
Heiko Stuebner
Reviewed-byAm Samstag, 25. April 2026, 20:10:27 Mitteleuropäische Sommerzeit schrieb Stephen Boyd:
Quoted 8 lines
Quoting Johan Hovold (2026-04-07 02:50:27)
Quoted 7 lines
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Fix this by using the intended helper for reusing OF nodes.
Quoted 7 lines
Quoted 5 lines
Fixes 2dc51ca822e4 ("clk: RK808: Reduce 'struct rk808' usage")Cc [email protected] # 6.5Cc Sebastian Reichel <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
+Heiko
Looking at the device_set_of_node_from_dev() function, this is the right move, so
It also seems the rk808-regulator.c might be another candidate for this, as it also takes the node without of_node_get and manually setting the of_node_reused flag.
Heiko
Quoted 18 lines
Quoted 17 lines
drivers/clk/clk-rk808.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/clk-rk808.c +1
-1@@ -153,7 +153,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)struct rk808_clkout *rk808_clkout;int ret; - dev->of_node = pdev->dev.parent->of_node; +device_set_of_node_from_dev (dev, dev->parent); rk808_clkout =devm_kzalloc (dev,sizeof (*rk808_clkout),GFP_KERNEL );
Quoted 4 lines · Heiko Stuebner
Looking at the
device_set_of_node_from_dev()function, this is the right move, soReviewed-by Heiko Stuebner <[email protected]>
Thanks for reviewing.
Quoted 3 lines
It also seems the
rk808-regulator.cmight be another candidate for this, as it also takes the node withoutof_node_getand manually setting theof_node_reusedflag.
That's fixed in 7.1-rc1:
65290b24d8a5 ("regulator: rk808: fix OF node reference imbalance")Johan
Am Montag, 27. April 2026, 14:03:20 Mitteleuropäische Sommerzeit schrieb Johan Hovold:
Quoted 9 lines · Heiko Stuebner
Quoted 5 lines
Looking at the
device_set_of_node_from_dev()function, this is the right move, soReviewed-by Heiko Stuebner <[email protected]>Thanks for reviewing.
Quoted 7 lines
Quoted 3 lines
It also seems the
rk808-regulator.cmight be another candidate for this, as it also takes the node withoutof_node_getand manually setting theof_node_reusedflag.That's fixed in 7.1-rc1:
65290b24d8a5 ("regulator: rk808: fix OF node reference imbalance")
nice ... should've looked there, instead of v7.0 :-)
Heiko
Heiko Stuebner
Reviewed-byAm Samstag, 25. April 2026, 20:10:27 Mitteleuropäische Sommerzeit schrieb Stephen Boyd:
Quoted 8 lines
Quoting Johan Hovold (2026-04-07 02:50:27)
Quoted 7 lines
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Fix this by using the intended helper for reusing OF nodes.
Quoted 7 lines
Quoted 5 lines
Fixes 2dc51ca822e4 ("clk: RK808: Reduce 'struct rk808' usage")Cc [email protected] # 6.5Cc Sebastian Reichel <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
+Heiko
I've looked that up, and that is the right way to go
Quoted 19 lines
Quoted 18 lines
drivers/clk/clk-rk808.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/clk-rk808.c +1
-1@@ -153,7 +153,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)struct rk808_clkout *rk808_clkout;int ret; - dev->of_node = pdev->dev.parent->of_node; +device_set_of_node_from_dev (dev, dev->parent); rk808_clkout =devm_kzalloc (dev,sizeof (*rk808_clkout),GFP_KERNEL );
Quoting Johan Hovold (2026-04-07 02:50:27)
Quoted 5 lines
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Quoted 7 lines
Fix this by using the intended helper for reusing OF nodes.
Fixes 2dc51ca822e4 ("clk: RK808: Reduce 'struct rk808' usage")Cc [email protected] # 6.5Cc Sebastian Reichel <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
Applied to clk-fixes