lkml.org 
[lkml]   [2013]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] dma: of: Fix of_node reference leak
Date
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


\
 
 \ /
  Last update: 2013-04-19 12:41    [W:0.128 / U:0.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site