aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRuoyu Wang <ruoyuw560@gmail.com>2026-08-13 23:31:49 +0800
committerVinod Koul <vkoul@kernel.org>2026-09-03 21:27:09 +0530
commita7df136ec529ee49a789c5029bc37b98b0d4bedd (patch)
tree263fbe62710db55d8b7b56e93b2f0055e231e134
parentdmaengine: ti: k3-udma-glue: fix NULL dereference in k3_udma_glue_release_rx_chn() (diff)
dmaengine: sprd: Fix runtime PM reference leak in probe
pm_runtime_get_sync() increments a device's usage counter even when it fails. sprd_dma_probe() currently jumps directly to controller clock cleanup on that error, bypassing both pm_runtime_put_noidle() and pm_runtime_disable(). This can happen if the preceding unchecked pm_runtime_set_active() fails and the following runtime-resume attempt also returns an error. Enter the existing runtime-PM unwind path instead. This drops the reference without idling the partially initialized device, disables runtime PM, and then releases the controller clocks. The success path and propagated error code are unchanged. This issue was found by a static analysis checker and confirmed by manual source review. Fixes: 9b3b8171f7f4 ("dmaengine: sprd: Add Spreadtrum DMA driver") Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Link: https://patch.msgid.link/20260813153149.3953497-1-ruoyuw560@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/dma/sprd-dma.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 087fea3af2e4..19b32a23c882 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -1212,7 +1212,7 @@ static int sprd_dma_probe(struct platform_device *pdev)
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0)
- goto err_rpm;
+ goto err_register;
ret = dma_async_device_register(&sdev->dma_dev);
if (ret < 0) {
@@ -1234,7 +1234,6 @@ err_of_register:
err_register:
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
-err_rpm:
sprd_dma_disable(sdev);
return ret;
}