mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: tps6594-regulator: Fix np_pmic_parent leak in tps6594_regulator_probe()
@ 2026-09-17 14:31 Wentao Liang
  2026-09-17 22:21 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Wentao Liang @ 2026-09-17 14:31 UTC (permalink / raw)
  To: broonie; +Cc: eblanc, jneanne, lgirdwood, linux-kernel, Wentao Liang, stable

tps6594_regulator_probe() takes a reference on the PMIC parent node
with of_get_parent(), but never drops it, so the reference leaks on
every loop iteration and on each error return of the probe.

Release the reference after its last use.

Fixes: f17ccc5deb4d ("regulator: tps6594-regulator: Add driver for TI TPS6594 regulators")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/regulator/tps6594-regulator.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/tps6594-regulator.c b/drivers/regulator/tps6594-regulator.c
index 645e83462c64..e0ae2cac0b66 100644
--- a/drivers/regulator/tps6594-regulator.c
+++ b/drivers/regulator/tps6594-regulator.c
@@ -673,8 +673,10 @@ static int tps6594_regulator_probe(struct platform_device *pdev)
 		np = of_find_node_by_name(tps->dev->of_node, multi_regs->supply_name);
 		npname = of_node_full_name(np);
 		np_pmic_parent = of_get_parent(of_get_parent(np));
-		if (of_node_cmp(of_node_full_name(np_pmic_parent), tps->dev->of_node->full_name))
+		if (of_node_cmp(of_node_full_name(np_pmic_parent), tps->dev->of_node->full_name)) {
+			of_node_put(np_pmic_parent);
 			continue;
+		}
 		if (strcmp(npname, multi_regs->supply_name) == 0) {
 			switch (multi) {
 			case MULTI_BUCK12:
@@ -706,6 +708,8 @@ static int tps6594_regulator_probe(struct platform_device *pdev)
 				break;
 			}
 		}
+
+		of_node_put(np_pmic_parent);
 	}
 
 	reg_irq_nb = desc->num_irq_types * (desc->num_buck_regs + desc->num_ldo_regs);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-07 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 14:31 [PATCH] regulator: tps6594-regulator: Fix np_pmic_parent leak in tps6594_regulator_probe() Wentao Liang
2026-09-17 22:21 ` Mark Brown
2026-11-07  7:00   ` Wentao Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®