[PATCH v2 07/13] dmaengine: ste_dma40: Fix probe runtime PM disable
Linus Walleij <[email protected]>
| Newsgroups | org.kernel.vger.phone-devel,org.kernel.vger.dmaengine |
|---|---|
| Message-ID | <[email protected]> |
Some d40_probe() error paths jump to destroy_cache before runtime PM has been enabled for the DMA controller device. The label unconditionally calls pm_runtime_disable(), which increments disable_depth even though this probe attempt never enabled runtime PM. Track whether this probe attempt enabled runtime PM before disabling it on the error path. This is not about a later deferred-probe retry, since the driver is registered with platform_driver_probe(); it keeps the probe unwind balanced. Reported-by: [email protected] Closes: https://lore.kernel.org/dmaengine/[email protected]/ Assisted-by: Codex:gpt-5-5 Signed-off-by: Linus Walleij <[email protected]> --- drivers/dma/ste_dma40.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 739e47941d0c..0c9094b4c4ad 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3512,6 +3512,7 @@ static int __init d40_probe(struct platform_device *pdev) struct resource res_lcpa; void *dmaenginem_reg_group; int num_reserved_chans; + bool runtime_pm_enabled = false; u32 val; int ret; @@ -3633,6 +3634,7 @@ static int __init d40_probe(struct platform_device *pdev) pm_runtime_mark_last_busy(base->dev); pm_runtime_set_active(base->dev); pm_runtime_enable(base->dev); + runtime_pm_enabled = true; dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE); @@ -3678,7 +3680,8 @@ static int __init d40_probe(struct platform_device *pdev) regulator_disable(base->lcpa_regulator); regulator_put(base->lcpa_regulator); } - pm_runtime_disable(base->dev); + if (runtime_pm_enabled) + pm_runtime_disable(base->dev); report_failure: d40_err(dev, "probe failed\n"); -- 2.55.0