Skip to content

Commit 83eb486

Browse files
YuKuai-huaweivinodkoul
authored andcommitted
dmaengine: stm32-mdma: fix PM reference leak in stm32_mdma_alloc_chan_resourc()
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Reported-by: Hulk Robot <[email protected]> Signed-off-by: Yu Kuai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 8982d48 commit 83eb486

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/dma/stm32-mdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c)
14521452
return -ENOMEM;
14531453
}
14541454

1455-
ret = pm_runtime_get_sync(dmadev->ddev.dev);
1455+
ret = pm_runtime_resume_and_get(dmadev->ddev.dev);
14561456
if (ret < 0)
14571457
return ret;
14581458

@@ -1718,7 +1718,7 @@ static int stm32_mdma_pm_suspend(struct device *dev)
17181718
u32 ccr, id;
17191719
int ret;
17201720

1721-
ret = pm_runtime_get_sync(dev);
1721+
ret = pm_runtime_resume_and_get(dev);
17221722
if (ret < 0)
17231723
return ret;
17241724

0 commit comments

Comments
 (0)