dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: sh: usb-dmac: handle pm_runtime_get_sync failure
@ 2020-06-04 20:30 Navid Emamdoost
  2020-06-04 23:55 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2020-06-04 20:30 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, Geert Uytterhoeven, Simon Horman,
	Stephen Boyd, Navid Emamdoost, dmaengine, linux-kernel
  Cc: emamd001, wu000273, kjlu, mccamant

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-05  0:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 20:30 [PATCH] dmaengine: sh: usb-dmac: handle pm_runtime_get_sync failure Navid Emamdoost
2020-06-04 23:55 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).