]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
dma: of: Fix of_node reference leak
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 19 Apr 2013 09:42:13 +0000 (11:42 +0200)
committerVinod Koul <vinod.koul@intel.com>
Thu, 2 May 2013 16:20:38 +0000 (21:50 +0530)
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>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/of-dma.c

index 8266893fef45bd25964ddbe27177163431bfdcfa..2882403a39cf2f487ee5d234ca3414f53055d6dc 100644 (file)
@@ -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);