dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails
PATCH 1/1 dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails
Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count. Call pm_runtime_put if pm_runtime_get_sync fails.
Signed-off-by Navid Emamdoost <[email protected]>
--- drivers/dma/stm32-mdma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/stm32-mdma.c +6 -2
@@ -1449,8 +1449,10 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c) } ret =pm_runtime_get_sync (dmadev->ddev.dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (dmadev->ddev.dev);return ret; + } ret =stm32_mdma_disable_chan (chan);if (ret <0 )
@@ -1718,8 +1720,10 @@ static int stm32_mdma_pm_suspend(struct device *dev)int ret; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);return ret; + }for (id =0 ; id < dmadev->nr_channels; id++) { ccr =stm32_mdma_read (dmadev,STM32_MDMA_CCR (id));
Signature · 1 line
2.17.1
Vinod Koul
maintainerQuoted 26 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>--- drivers/dma/stm32-mdma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/dma/stm32-mdma.c +3
-1@@ -1449,8 +1449,10 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c) } ret =pm_runtime_get_sync (dmadev->ddev.dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (dmadev->ddev.dev);return ret; + } ret =stm32_mdma_disable_chan (chan);if (ret <0 )
drivers/dma/stm32-mdma.c static int stm32_mdma_pm_suspend(struct device *dev) · line 1724
Quoted 6 lines
drivers/dma/stm32-mdma.c +2
-1@@ -1718,8 +1720,10 @@ static int stm32_mdma_pm_suspend(struct device *dev)int ret; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);
Not put_sync()...
Quoted 7 lines
drivers/dma/stm32-mdma.c +1
-0return ret; + }for (id =0 ; id < dmadev->nr_channels; id++) { ccr =stm32_mdma_read (dmadev,STM32_MDMA_CCR (id));Signature · 1 line
2.17.1
Signature · 1 line
~Vinod