* [PATCH] pmdomain: ti: fix device node leak in probe
@ 2026-10-01 16:27 Aryan Sinha
0 siblings, 0 replies; only message in thread
From: Aryan Sinha @ 2026-10-01 16:27 UTC (permalink / raw)
To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Ulf Hansson
Cc: linux-pm, linux-arm-kernel, linux-kernel, Aryan Sinha
for_each_node_with_property() takes a reference on np each iteration
and drops it on the next one. The two allocation failure paths return
from inside the loop, so np is leaked.
Put np before returning fixes it.
Fixes: efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one")
Signed-off-by: Aryan Sinha <sinha.aryan03@gmail.com>
---
drivers/pmdomain/ti/ti_sci_pm_domains.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c
index 949e4115f..9cb6133fd 100644
--- a/drivers/pmdomain/ti/ti_sci_pm_domains.c
+++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c
@@ -262,14 +262,18 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
}
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
- if (!pd)
+ if (!pd) {
+ of_node_put(np);
return -ENOMEM;
+ }
pd->pd.name = devm_kasprintf(dev, GFP_KERNEL,
"pd:%d",
args.args[0]);
- if (!pd->pd.name)
+ if (!pd->pd.name) {
+ of_node_put(np);
return -ENOMEM;
+ }
pd->pd.power_off = ti_sci_pd_power_off;
pd->pd.power_on = ti_sci_pd_power_on;
--
2.46.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-01 16:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 16:27 [PATCH] pmdomain: ti: fix device node leak in probe Aryan Sinha
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®