Skip to contentSkip to conversation

regulator: more OF node reference fixes

PATCH In review Johan Hovold 2 participants 5 messages Apr 7

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

cover regulator: more OF node reference fixes

Here's a second set of fixes for drivers that reuse OF nodes.

Johan

Johan Hovold (3):
regulator: max77650: fix OF node reference imbalance
regulator: mt6357: fix OF node reference imbalance
regulator: s2dos05: fix OF node reference imbalance

 drivers/regulator/max77650-regulator.c | 2 +-
 drivers/regulator/mt6357-regulator.c   | 2 +-
 drivers/regulator/s2dos05-regulator.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/3 regulator: max77650: 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 bcc61f1c44fd ("regulator: max77650: add regulator support")
Cc Bartosz Golaszewski <[email protected]>
---
 drivers/regulator/max77650-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max77650-regulator.c +1 -1
index a809264c77fc..11b04a13f889 100644
@@ -337,7 +337,7 @@ static int max77650_regulator_probe(struct platform_device *pdev)
 	parent = dev->parent;
 
 	if (!dev->of_node)
-		dev->of_node = parent->of_node;
+		device_set_of_node_from_dev(dev, parent);
 
 	rdescs = devm_kcalloc(dev, MAX77650_REGULATOR_NUM_REGULATORS,
 			      sizeof(*rdescs), GFP_KERNEL);
Signature · 1 line
2.52.0
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] regulator: max77650: fix OF node reference imbalance

Quoted 29 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 bcc61f1c44fd ("regulator: max77650: add regulator support")
Cc Bartosz Golaszewski <[email protected]>
---
 drivers/regulator/max77650-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max77650-regulator.c +1 -2
index a809264c77fc..11b04a13f889 100644
@@ -337,7 +337,7 @@ static int max77650_regulator_probe(struct platform_device *pdev)
 	parent = dev->parent;
 
 	if (!dev->of_node)
-		dev->of_node = parent->of_node;
+		device_set_of_node_from_dev(dev, parent);
 
 	rdescs = devm_kcalloc(dev, MAX77650_REGULATOR_NUM_REGULATORS,
 			      sizeof(*rdescs), GFP_KERNEL);
--
Quoted 3 lines

2.52.0

#3 lore raw

PATCH 2/3 regulator: mt6357: fix OF node reference imbalance

In reply to 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 dafc7cde23dc ("regulator: add mt6357 regulator")
---
 drivers/regulator/mt6357-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/mt6357-regulator.c +1 -1
index 1eb69c7a6acb..09feb454ab6b 100644
@@ -410,7 +410,7 @@ static int mt6357_regulator_probe(struct platform_device *pdev)
 	struct regulator_dev *rdev;
 	int i;
 
-	pdev->dev.of_node = pdev->dev.parent->of_node;
+	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
 
 	for (i = 0; i < MT6357_MAX_REGULATOR; i++) {
 		config.dev = &pdev->dev;
Signature · 1 line
2.52.0
#4 lore raw

PATCH 3/3 regulator: s2dos05: fix OF node reference imbalance

In reply to 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 bb2441402392 ("regulator: add s2dos05 regulator support")
Cc Dzmitry Sankouski <[email protected]>
---
 drivers/regulator/s2dos05-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/s2dos05-regulator.c +1 -1
index 1463585c4565..a1c394ddbaff 100644
@@ -126,7 +126,7 @@ static int s2dos05_pmic_probe(struct platform_device *pdev)
 	s2dos05->regmap = iodev->regmap_pmic;
 	s2dos05->dev = dev;
 	if (!dev->of_node)
-		dev->of_node = dev->parent->of_node;
+		device_set_of_node_from_dev(dev, dev->parent);
 
 	config.dev = dev;
 	config.driver_data = s2dos05;
Signature · 1 line
2.52.0