engine: stm32-dma: call pm_runtime_put if pm_runtime_get_sync fails
PATCH 1/1 engine: stm32-dma: 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.
--- drivers/dma/stm32-dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/stm32-dma.c +6 -2
@@ -1169,8 +1169,10 @@ static int stm32_dma_alloc_chan_resources(struct dma_chan *c) chan->config_init = false; ret =pm_runtime_get_sync (dmadev->ddev.dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (dmadev->ddev.dev);return ret; + } ret =stm32_dma_disable_chan (chan);if (ret <0 )
@@ -1439,8 +1441,10 @@ static int stm32_dma_suspend(struct device *dev)int id, ret, scr; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);return ret; + }for (id =0 ; id <STM32_DMA_MAX_CHANNELS ; id++) { scr =stm32_dma_read (dmadev,STM32_DMA_SCR (id));
Signature · 1 line
2.17.1
Vinod Koul
maintainerQuoted 3 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.
pls fix subsystem name as dmaengine: ...
Quoted 23 lines
Signed-off-by Navid Emamdoost <[email protected]>--- drivers/dma/stm32-dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/dma/stm32-dma.c +3
-1@@ -1169,8 +1169,10 @@ static int stm32_dma_alloc_chan_resources(struct dma_chan *c) chan->config_init = false; ret =pm_runtime_get_sync (dmadev->ddev.dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (dmadev->ddev.dev);return ret; + } ret =stm32_dma_disable_chan (chan);if (ret <0 )
drivers/dma/stm32-dma.c static int stm32_dma_suspend(struct device *dev) · line 1445
Quoted 6 lines
drivers/dma/stm32-dma.c +2
-1@@ -1439,8 +1441,10 @@ static int stm32_dma_suspend(struct device *dev)int id, ret, scr; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);
why put_sync()
Quoted 7 lines
drivers/dma/stm32-dma.c +1
-0return ret; + }for (id =0 ; id <STM32_DMA_MAX_CHANNELS ; id++) { scr =stm32_dma_read (dmadev,STM32_DMA_SCR (id));Signature · 1 line
2.17.1
Signature · 1 line
~Vinod
Hi,
Quoted 32 lines · Vinod Koul
Quoted 3 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.pls fix subsystem name as dmaengine: ...
Quoted 25 lines
Signed-off-by Navid Emamdoost <[email protected]>--- drivers/dma/stm32-dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/dma/stm32-dma.c +3
-1@@ -1169,8 +1169,10 @@ static int stm32_dma_alloc_chan_resources(struct dma_chan *c) chan->config_init = false; ret =pm_runtime_get_sync (dmadev->ddev.dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (dmadev->ddev.dev);return ret; + } ret =stm32_dma_disable_chan (chan);if (ret <0 )@@ -1439,8 +1441,10 @@ static int stm32_dma_suspend(struct device *dev)int id, ret, scr;
Quoted 6 lines
drivers/dma/stm32-dma.c static int stm32_dma_suspend(struct device *dev) · line 1445
Quoted 4 lines
drivers/dma/stm32-dma.c +2
-1ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);why
put_sync()
My bad! I will fix it.
Quoted 10 lines
Quoted 7 lines
drivers/dma/stm32-dma.c +1
-1return ret; + }for (id =0 ; id <STM32_DMA_MAX_CHANNELS ; id++) { scr =stm32_dma_read (dmadev,STM32_DMA_SCR (id)); --2.17.1
--
~Vinod
Signature · 1 line
Navid.