Commit 740b4be3 authored by Tony Lindgren's avatar Tony Lindgren Committed by Vinod Koul

dmaengine: cpp41: Fix handling of error path

If we return early on pm_runtime_get() error, we need to also call
pm_runtime_put_noidle() as pointed out in a musb related thread
by Johan Hovold <johan@kernel.org>. This is to keep the PM runtime
use counts happy.

Fixes: fdea2d09 ("dmaengine: cppi41: Add basic PM runtime support")
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 098de42a
...@@ -366,8 +366,11 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan) ...@@ -366,8 +366,11 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan)
int error; int error;
error = pm_runtime_get_sync(cdd->ddev.dev); error = pm_runtime_get_sync(cdd->ddev.dev);
if (error < 0) if (error < 0) {
pm_runtime_put_noidle(cdd->ddev.dev);
return error; return error;
}
dma_cookie_init(chan); dma_cookie_init(chan);
dma_async_tx_descriptor_init(&c->txd, chan); dma_async_tx_descriptor_init(&c->txd, chan);
...@@ -389,8 +392,11 @@ static void cppi41_dma_free_chan_resources(struct dma_chan *chan) ...@@ -389,8 +392,11 @@ static void cppi41_dma_free_chan_resources(struct dma_chan *chan)
int error; int error;
error = pm_runtime_get_sync(cdd->ddev.dev); error = pm_runtime_get_sync(cdd->ddev.dev);
if (error < 0) if (error < 0) {
pm_runtime_put_noidle(cdd->ddev.dev);
return; return;
}
WARN_ON(!list_empty(&cdd->pending)); WARN_ON(!list_empty(&cdd->pending));
...@@ -466,6 +472,7 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) ...@@ -466,6 +472,7 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
error = pm_runtime_get(cdd->ddev.dev); error = pm_runtime_get(cdd->ddev.dev);
if ((error != -EINPROGRESS) && error < 0) { if ((error != -EINPROGRESS) && error < 0) {
pm_runtime_put_noidle(cdd->ddev.dev);
dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n",
error); error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment