dmaengine: sprd: handle the failure cases of pm_runtime_get_sync
Subsystems (2)
PATCH 1/1 dmaengine: sprd: handle the failure cases of pm_runtime_get_sync
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/sprd-dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/sprd-dma.c +6 -2
@@ -1204,8 +1204,10 @@ static int sprd_dma_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (&pdev->dev); goto err_rpm; + } ret =dma_async_device_register (&sdev->dma_dev);if (ret <0 ) {
@@ -1239,8 +1241,10 @@ static int sprd_dma_remove(struct platform_device *pdev)int ret; ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (&pdev->dev);return ret; + }/* explicitly free the irq */ if (sdev->irq >0 )
Signature · 1 line
2.17.1