[PATCH v2] bus: ti-pwmss: unwind child devices and runtime PM
Pengpeng Hou <[email protected]>
| Newsgroups | org.kernel.vger.linux-omap,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
pwmss_probe() enables runtime PM before populating child devices. If
population partially succeeds and then fails, probe leaves both the
children and runtime PM state behind. The remove path likewise lacks
the matching child depopulation.
Depopulate partial children and disable runtime PM on probe failure.
Depopulate children before disabling runtime PM during removal.
Fixes: af0ba001d208 ("pwm: Add TI PWM subsystem driver")
Assisted-by: Codex:gpt-5
Signed-off-by: Pengpeng Hou <[email protected]>
---
Changes since v1: https://lore.kernel.org/all/[email protected]/
- route the orphaned driver change to OMAP maintainers and lists
- depopulate partially created children on probe failure
- depopulate children before runtime-PM teardown on remove
The child/runtime-PM unwind order was reviewed statically; no AM33xx
bind/unbind test was performed.
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.50.1 (Apple Git-155)