From: Lars-Peter Clausen Date: Fri, 19 Apr 2013 09:42:13 +0000 (+0200) Subject: dma: of: Fix of_node reference leak X-Git-Tag: firefly_0821_release~3680^2~523^2~1^2~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f22eb1402244885126c4263eb36b857e4182dd6f;p=firefly-linux-kernel-4.4.55.git dma: of: Fix of_node reference leak 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 Acked-by: Arnd Bergmann Reviewed-by: Jon Hunter Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c index 8266893fef45..2882403a39cf 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);