linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dma: of: Fix of_node reference leak
@ 2013-04-19  9:42 Lars-Peter Clausen
  2013-04-19  9:42 ` [PATCH 2/2] dma:of: Use a mutex to protect the of_dma_list Lars-Peter Clausen
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Lars-Peter Clausen @ 2013-04-19  9:42 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Arnd Bergmann, Jon Hunter, linux-kernel, Lars-Peter Clausen

of_dma_request_slave_channel() currently does not drop the reference to the
dma_spec of_node if no DMA controller matching the of_node could be found. This
patch fixes it by always calling of_node_put().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/dma/of-dma.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 8266893..2882403 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -221,12 +221,13 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
 
 		ofdma = of_dma_get_controller(&dma_spec);
 
-		if (!ofdma)
-			continue;
-
-		chan = ofdma->of_dma_xlate(&dma_spec, ofdma);
+		if (ofdma) {
+			chan = ofdma->of_dma_xlate(&dma_spec, ofdma);
 
-		of_dma_put_controller(ofdma);
+			of_dma_put_controller(ofdma);
+		} else {
+			chan = NULL;
+		}
 
 		of_node_put(dma_spec.np);
 
-- 
1.8.0


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

end of thread, other threads:[~2013-05-02 16:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19  9:42 [PATCH 1/2] dma: of: Fix of_node reference leak Lars-Peter Clausen
2013-04-19  9:42 ` [PATCH 2/2] dma:of: Use a mutex to protect the of_dma_list Lars-Peter Clausen
2013-04-19 10:13   ` Arnd Bergmann
2013-04-19 11:04     ` Lars-Peter Clausen
2013-04-19 12:25       ` Arnd Bergmann
2013-04-19 22:45   ` Jon Hunter
2013-04-19 23:13     ` Arnd Bergmann
2013-04-22  1:22       ` Jon Hunter
2013-04-20  7:28     ` Lars-Peter Clausen
2013-04-20 10:38       ` Arnd Bergmann
2013-04-22  1:18         ` Jon Hunter
2013-04-19 10:10 ` [PATCH 1/2] dma: of: Fix of_node reference leak Arnd Bergmann
2013-04-19 22:29   ` Jon Hunter
2013-05-02 16:24 ` Vinod Koul

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