[PATCH] dmaengine: qcom-bam-dma: fix autosuspend cleanup during removal

Guangshuo Li posted 1 patch 1 month, 3 weeks ago
drivers/dma/qcom/bam_dma.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] dmaengine: qcom-bam-dma: fix autosuspend cleanup during removal
Posted by Guangshuo Li 1 month, 3 weeks ago
bam_dma_probe() calls pm_runtime_use_autosuspend(), but
bam_dma_remove() does not call the matching
pm_runtime_dont_use_autosuspend() when removing the device.

If the autosuspend delay is set to a negative value while autosuspend
is enabled, the runtime PM core increments usage_count to prevent
runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
during teardown, this reference is not dropped and usage_count remains
unbalanced.

Add the missing pm_runtime_dont_use_autosuspend() call before forcing
the device into runtime suspend during removal.

This issue was found by manual code inspection.

Fixes: 7d2545599f5b ("dmaengine: qcom-bam-dma: Add pm_runtime support")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/dma/qcom/bam_dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 1bb26af0405f..05a3b1f9e0c2 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -1401,6 +1401,7 @@ static void bam_dma_remove(struct platform_device *pdev)
 	struct bam_device *bdev = platform_get_drvdata(pdev);
 	u32 i;
 
+	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	pm_runtime_force_suspend(&pdev->dev);
 
 	of_dma_controller_free(pdev->dev.of_node);
-- 
2.43.0
Re: [PATCH] dmaengine: qcom-bam-dma: fix autosuspend cleanup during removal
Posted by Vinod Koul 1 month, 2 weeks ago
On Sat, 08 Aug 2026 19:06:42 +0800, Guangshuo Li wrote:
> bam_dma_probe() calls pm_runtime_use_autosuspend(), but
> bam_dma_remove() does not call the matching
> pm_runtime_dont_use_autosuspend() when removing the device.
> 
> If the autosuspend delay is set to a negative value while autosuspend
> is enabled, the runtime PM core increments usage_count to prevent
> runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
> during teardown, this reference is not dropped and usage_count remains
> unbalanced.
> 
> [...]

Applied, thanks!

[1/1] dmaengine: qcom-bam-dma: fix autosuspend cleanup during removal
      commit: a50184171235045d96104811414b25cf5338cf86

Best regards,
-- 
~Vinod
Re: [PATCH] dmaengine: qcom-bam-dma: fix autosuspend cleanup during removal
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
On Sat, 8 Aug 2026 13:06:42 +0200, Guangshuo Li
<lgs201920130244@gmail.com> said:
> bam_dma_probe() calls pm_runtime_use_autosuspend(), but
> bam_dma_remove() does not call the matching
> pm_runtime_dont_use_autosuspend() when removing the device.
>
> If the autosuspend delay is set to a negative value while autosuspend
> is enabled, the runtime PM core increments usage_count to prevent
> runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
> during teardown, this reference is not dropped and usage_count remains
> unbalanced.
>
> Add the missing pm_runtime_dont_use_autosuspend() call before forcing
> the device into runtime suspend during removal.
>
> This issue was found by manual code inspection.
>
> Fixes: 7d2545599f5b ("dmaengine: qcom-bam-dma: Add pm_runtime support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>