diff options
author | Tony Lindgren <tony@atomide.com> | 2016-11-11 14:28:52 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2016-11-14 03:30:16 -0500 |
commit | 740b4be3f742100ea66f0f9ee9715b10ee304a90 (patch) | |
tree | 5acde2aa9781ffde6d2c4d59acfd724e3e242bd2 /drivers | |
parent | 098de42ad6708866501a00155ba85350bc0b29e5 (diff) |
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: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/cppi41.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index 3d2d8b5a6c91..4b52126c13cf 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c | |||
@@ -366,8 +366,11 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan) | |||
366 | int error; | 366 | int error; |
367 | 367 | ||
368 | error = pm_runtime_get_sync(cdd->ddev.dev); | 368 | error = pm_runtime_get_sync(cdd->ddev.dev); |
369 | if (error < 0) | 369 | if (error < 0) { |
370 | pm_runtime_put_noidle(cdd->ddev.dev); | ||
371 | |||
370 | return error; | 372 | return error; |
373 | } | ||
371 | 374 | ||
372 | dma_cookie_init(chan); | 375 | dma_cookie_init(chan); |
373 | dma_async_tx_descriptor_init(&c->txd, chan); | 376 | dma_async_tx_descriptor_init(&c->txd, chan); |
@@ -389,8 +392,11 @@ static void cppi41_dma_free_chan_resources(struct dma_chan *chan) | |||
389 | int error; | 392 | int error; |
390 | 393 | ||
391 | error = pm_runtime_get_sync(cdd->ddev.dev); | 394 | error = pm_runtime_get_sync(cdd->ddev.dev); |
392 | if (error < 0) | 395 | if (error < 0) { |
396 | pm_runtime_put_noidle(cdd->ddev.dev); | ||
397 | |||
393 | return; | 398 | return; |
399 | } | ||
394 | 400 | ||
395 | WARN_ON(!list_empty(&cdd->pending)); | 401 | WARN_ON(!list_empty(&cdd->pending)); |
396 | 402 | ||
@@ -466,6 +472,7 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) | |||
466 | 472 | ||
467 | error = pm_runtime_get(cdd->ddev.dev); | 473 | error = pm_runtime_get(cdd->ddev.dev); |
468 | if ((error != -EINPROGRESS) && error < 0) { | 474 | if ((error != -EINPROGRESS) && error < 0) { |
475 | pm_runtime_put_noidle(cdd->ddev.dev); | ||
469 | dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", | 476 | dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", |
470 | error); | 477 | error); |
471 | 478 | ||