linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: cpp41: Fix handling of error path
@ 2016-11-11 19:28 Tony Lindgren
       [not found] ` <20161111192852.25399-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Tony Lindgren @ 2016-11-11 19:28 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul
  Cc: Bin Liu, Daniel Mack, Felipe Balbi, George Cherian, Johan Hovold,
	Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

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-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>. This is to keep the PM runtime
use counts happy.

Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Cc: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/dma/cppi41.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
--- 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)
 	int error;
 
 	error = pm_runtime_get_sync(cdd->ddev.dev);
-	if (error < 0)
+	if (error < 0) {
+		pm_runtime_put_noidle(cdd->ddev.dev);
+
 		return error;
+	}
 
 	dma_cookie_init(chan);
 	dma_async_tx_descriptor_init(&c->txd, chan);
@@ -389,8 +392,11 @@ static void cppi41_dma_free_chan_resources(struct dma_chan *chan)
 	int error;
 
 	error = pm_runtime_get_sync(cdd->ddev.dev);
-	if (error < 0)
+	if (error < 0) {
+		pm_runtime_put_noidle(cdd->ddev.dev);
+
 		return;
+	}
 
 	WARN_ON(!list_empty(&cdd->pending));
 
@@ -466,6 +472,7 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
 
 	error = pm_runtime_get(cdd->ddev.dev);
 	if ((error != -EINPROGRESS) && error < 0) {
+		pm_runtime_put_noidle(cdd->ddev.dev);
 		dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n",
 			error);
 
-- 
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-11-16 17:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-11 19:28 [PATCH] dma: cpp41: Fix handling of error path Tony Lindgren
     [not found] ` <20161111192852.25399-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-14  8:31   ` Vinod Koul
2016-11-14 14:34   ` Johan Hovold
2016-11-14 14:41     ` Johan Hovold
2016-11-14 14:47     ` Tony Lindgren
     [not found]       ` <20161114144731.GQ7138-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-14 14:59         ` Johan Hovold
2016-11-14 15:07           ` Tony Lindgren
2016-11-15  8:35   ` Sekhar Nori
     [not found]     ` <8d1e380a-ec75-3893-ea50-65e1526d58ea-l0cyMroinI0@public.gmane.org>
2016-11-15 20:58       ` Tony Lindgren
     [not found]         ` <20161115205816.GN4082-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-15 21:27           ` Bin Liu
2016-11-16  6:25           ` Sekhar Nori
     [not found]             ` <91726bb9-4919-22a4-174b-9c89e1001421-l0cyMroinI0@public.gmane.org>
2016-11-16 14:54               ` Tony Lindgren
     [not found]                 ` <20161116145455.GP4082-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-16 17:11                   ` Tony Lindgren

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).