Skip to contentSkip to conversation

power: supply: max17042: fix OF node reference imbalance

PATCH Applied Johan Hovold 2 participants 3 messages Apr 7 – Jun 3

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

PATCH v2 1/1 power: supply: max17042: 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 0cd4f1f77ad4 ("power: supply: max17042: add platform driver variant")
Cc Dzmitry Sankouski <[email protected]>

---

Changes in v2:
- add missing driver name to patch summary prefix

 drivers/power/supply/max17042_battery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +2 -1
index acea176101fa..914f18ce79b3 100644
@@ -1165,7 +1165,8 @@ static int max17042_platform_probe(struct platform_device *pdev)
 	if (!i2c)
 		return -EINVAL;
 
-	dev->of_node = dev->parent->of_node;
+	device_set_of_node_from_dev(dev, dev->parent);
+
 	id = platform_get_device_id(pdev);
 	irq = platform_get_irq(pdev, 0);
 
Signature · 1 line
2.52.0
#1 lore raw

Hi Sebastian,

Quoted 7 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.

Quoted 8 lines
Fixes 0cd4f1f77ad4 ("power: supply: max17042: add platform driver variant")
Cc Dzmitry Sankouski <[email protected]>

---

Changes in v2:
- add missing driver name to patch summary prefix

Can this one be picked up now?

Johan

#2 lore raw
In reply to Johan Hovold
Quoted 8 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.

[...]

Applied, thanks!

[1/1] power: supply: max17042: fix OF node reference imbalance

      commit: 68d234144b7dffd1f50b07ba74d0d6e833ef43a4

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>