[PATCH] dmaengine: owl-dma: Handle clock enable failure in probe
Jiawen Liu
liu1298662399 at gmail.com
Sun Nov 29 11:25:33 PST 2026
On S900, with firmware device links disabled, the CMU driver can unbind
after owl_dma_probe() gets the DMA clock and before it prepares it. The
clock framework can then return -ENXIO when preparing the retained clock.
Ignoring that error can expose DMA channels without the required clock.
A later registration failure or device removal can also attempt an
unmatched clock disable and unprepare, which can trigger clock warnings.
Check clk_prepare_enable() and return its error after freeing the
descriptor pool. Keep clock teardown on the registration error paths,
where clock setup has succeeded.
Verification covered
the probe and remove paths by source inspection, git diff --check,
checkpatch, and an arm64 defconfig build of drivers/dma/owl-dma.o with
CONFIG_OWL_DMA=y. Runtime and hardware reproduction were not performed.
Fixes: 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
Signed-off-by: Jiawen Liu <liu1298662399 at gmail.com>
---
drivers/dma/owl-dma.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
index 31a6c6e01a750..c4032643c49ad 100644
--- a/drivers/dma/owl-dma.c
+++ b/drivers/dma/owl-dma.c
@@ -1199,12 +1199,14 @@ static int owl_dma_probe(struct platform_device *pdev)
return -ENOMEM;
}
- clk_prepare_enable(od->clk);
+ ret = clk_prepare_enable(od->clk);
+ if (ret)
+ goto err_pool_free;
ret = dma_async_device_register(&od->dma);
if (ret) {
dev_err(&pdev->dev, "failed to register DMA engine device\n");
- goto err_pool_free;
+ goto err_clk_disable;
}
/* Device-tree DMA controller registration */
@@ -1219,8 +1221,9 @@ static int owl_dma_probe(struct platform_device *pdev)
err_dma_unregister:
dma_async_device_unregister(&od->dma);
-err_pool_free:
+err_clk_disable:
clk_disable_unprepare(od->clk);
+err_pool_free:
dma_pool_destroy(od->lli_pool);
return ret;
--
2.34.1
More information about the linux-arm-kernel
mailing list