[PATCH] bus: ti-pwmss: unwind runtime PM on populate failure

From: Pengpeng Hou

Date: Tue Jun 16 2026 - 11:22:18 EST


pwmss_probe() enables runtime PM before populating child devices. If
child population fails, the probe returns the error but leaves runtime PM
enabled and any partially created child devices behind.

Depopulate partial children and disable runtime PM on populate failure.
Also depopulate children during remove before disabling runtime PM for the
parent subsystem device.

Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
drivers/bus/ti-pwmss.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/ti-pwmss.c b/drivers/bus/ti-pwmss.c
index 1f2cab91e438..0c92968b8d25 100644
--- a/drivers/bus/ti-pwmss.c
+++ b/drivers/bus/ti-pwmss.c
@@ -27,14 +27,18 @@ static int pwmss_probe(struct platform_device *pdev)

/* Populate all the child nodes here... */
ret = of_platform_populate(node, NULL, NULL, &pdev->dev);
- if (ret)
+ if (ret) {
dev_err(&pdev->dev, "no child node found\n");
+ of_platform_depopulate(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+ }

return ret;
}

static void pwmss_remove(struct platform_device *pdev)
{
+ of_platform_depopulate(&pdev->dev);
pm_runtime_disable(&pdev->dev);
}

--
2.43.0