lkml.org 
[lkml]   [2020]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] dmaengine: sh: usb-dmac: handle pm_runtime_get_sync failure
Date
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 <navid.emamdoost@gmail.com>
---
drivers/dma/sh/usb-dmac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index b218a013c260..43511434c90c 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -797,7 +797,7 @@ static int usb_dmac_probe(struct platform_device *pdev)
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0) {
dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);
- goto error_pm;
+ goto error_pm_get;
}

ret = usb_dmac_init(dmac);
@@ -853,6 +853,7 @@ static int usb_dmac_probe(struct platform_device *pdev)

error:
of_dma_controller_free(pdev->dev.of_node);
+error_pm_get:
pm_runtime_put(&pdev->dev);
error_pm:
pm_runtime_disable(&pdev->dev);
--
2.17.1
\
 
 \ /
  Last update: 2020-06-04 22:33    [W:0.688 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site