Skip to contentSkip to conversation

clk: rk808: fix OF node reference imbalance

PATCH Applied Johan Hovold 5 participants 9 messages Apr 7 – May 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

Fixes 2dc51ca822e4 ("clk: RK808: Reduce 'struct rk808' usage")
Cc Sebastian Reichel <[email protected]>
---
 drivers/clk/clk-rk808.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-rk808.c +1 -1
index f7412b137e5e..5a75b5c91555 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw

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 Sebastian Reichel <[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
index f7412b137e5e..5a75b5c91555 100644
@@ -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
Reviewed-by on v1 1/1
#2 lore raw
In reply to Johan Hovold
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 Sebastian Reichel <[email protected]>
maintainer
#3 lore raw
In reply to Johan Hovold

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 Sebastian Reichel <[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
index f7412b137e5e..5a75b5c91555 100644
@@ -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
Reviewed-by
#4 lore raw

Am 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 Sebastian Reichel <[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
index f7412b137e5e..5a75b5c91555 100644
@@ -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);
#5 lore raw
Quoted 4 lines · Heiko Stuebner

Looking at the device_set_of_node_from_dev() function, this is the right move, so

Thanks for reviewing.

Quoted 3 lines

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.

That's fixed in 7.1-rc1:

	65290b24d8a5 ("regulator: rk808: fix OF node reference imbalance")

Johan

#6 lore raw

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, so

Thanks for reviewing.

Quoted 7 lines
Quoted 3 lines

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.

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

Reviewed-by
#7 lore raw
In reply to Stephen Boyd

Am 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 Sebastian Reichel <[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
index f7412b137e5e..5a75b5c91555 100644
@@ -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);
maintainer Applied
#8 lore raw
In reply to Johan Hovold

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 Sebastian Reichel <[email protected]>

---

Applied to clk-fixes