dmaengine: stm32-dmamux: fix pm_runtime_get_sync fialure cases
PATCH 1/1 dmaengine: stm32-dmamux: fix pm_runtime_get_sync fialure cases
Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count. Call pm_runtime_put_sync if pm_runtime_get_sync fails.
--- drivers/dma/stm32-dmamux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/stm32-dmamux.c +4 -1
@@ -140,6 +140,7 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec, ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) {spin_unlock_irqrestore (&dmamux->lock, flags); +pm_runtime_put_sync (&pdev->dev); goto error; }spin_unlock_irqrestore (&dmamux->lock, flags);
@@ -340,8 +341,10 @@ static int stm32_dmamux_suspend(struct device *dev)int i, ret; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);return ret; + }for (i =0 ; i < stm32_dmamux->dma_requests; i++) stm32_dmamux->ccr[i] = stm32_dmamux_read(stm32_dmamux->iomem,
Signature · 1 line
2.17.1
Vinod Koul
maintainerOn 03-06-20, 14:36, Navid Emamdoost wrote:
s/fialure/failure
Quoted 14 lines
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_put_syncifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>--- drivers/dma/stm32-dmamux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/dma/stm32-dmamux.c +0
-0
drivers/dma/stm32-dmamux.c static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec, · line 143
Quoted 4 lines
drivers/dma/stm32-dmamux.c +1
-0@@ -140,6 +140,7 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec, ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) {spin_unlock_irqrestore (&dmamux->lock, flags); +pm_runtime_put_sync (&pdev->dev);
why put_sync()
drivers/dma/stm32-dmamux.c static int stm32_dmamux_suspend(struct device *dev) · line 345
Quoted 10 lines
drivers/dma/stm32-dmamux.c +2
-1goto error; }spin_unlock_irqrestore (&dmamux->lock, flags);@@ -340,8 +341,10 @@ static int stm32_dmamux_suspend(struct device *dev)int i, ret; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);
here too
Quoted 7 lines
drivers/dma/stm32-dmamux.c +1
-0return ret; + }for (i =0 ; i < stm32_dmamux->dma_requests; i++) stm32_dmamux->ccr[i] = stm32_dmamux_read(stm32_dmamux->iomem,Signature · 1 line
2.17.1
Signature · 1 line
~Vinod
Quoted 32 lines · Vinod Koul
On 03-06-20, 14:36, Navid Emamdoost wrote:
s/fialure/failure
Quoted 14 lines
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_put_syncifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>--- drivers/dma/stm32-dmamux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/dma/stm32-dmamux.c +0
-0drivers/dma/stm32-dmamux.c static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec, · line 143
Quoted 4 lines
drivers/dma/stm32-dmamux.c +1
-0@@ -140,6 +140,7 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec, ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) {spin_unlock_irqrestore (&dmamux->lock, flags); +pm_runtime_put_sync (&pdev->dev);why
put_sync()Quoted 6 lines
drivers/dma/stm32-dmamux.c +0
-0goto error; }spin_unlock_irqrestore (&dmamux->lock, flags);@@ -340,8 +341,10 @@ static int stm32_dmamux_suspend(struct device *dev)int i, ret;
Quoted 6 lines
drivers/dma/stm32-dmamux.c static int stm32_dmamux_suspend(struct device *dev) · line 345
Quoted 4 lines
drivers/dma/stm32-dmamux.c +2
-1ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_sync (dev);here too
Is put_noidle() better?
Quoted 11 lines
Quoted 8 lines
drivers/dma/stm32-dmamux.c +1
-1return ret; + }for (i =0 ; i < stm32_dmamux->dma_requests; i++) stm32_dmamux->ccr[i] = stm32_dmamux_read(stm32_dmamux->iomem, --2.17.1
--
~Vinod
Signature · 1 line
Navid.