[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200604203059.964-1-navid.emamdoost@gmail.com>
Date: Thu, 4 Jun 2020 15:30:57 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: Dan Williams <dan.j.williams@...el.com>,
Vinod Koul <vkoul@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Simon Horman <horms+renesas@...ge.net.au>,
Stephen Boyd <swboyd@...omium.org>,
Navid Emamdoost <navid.emamdoost@...il.com>,
dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: emamd001@....edu, wu000273@....edu, kjlu@....edu,
mccamant@...umn.edu
Subject: [PATCH] dmaengine: sh: usb-dmac: handle pm_runtime_get_sync failure
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@...il.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
Powered by blists - more mailing lists