mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: broonie@kernel.org
Cc: eblanc@baylibre.com, jneanne@baylibre.com, lgirdwood@gmail.com,
	linux-kernel@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] regulator: tps6594-regulator: Fix np_pmic_parent leak in tps6594_regulator_probe()
Date: Thu, 17 Sep 2026 14:31:55 +0000	[thread overview]
Message-ID: <20260917143155.2156974-1-vulab@iscas.ac.cn> (raw)

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


             reply	other threads:[~2026-09-17 14:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 14:31 Wentao Liang [this message]
2026-09-17 22:21 ` Mark Brown
2026-11-07  7:00   ` Wentao Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260917143155.2156974-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=broonie@kernel.org \
    --cc=eblanc@baylibre.com \
    --cc=jneanne@baylibre.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®