Skip to content

Commit

Permalink
dmaengine: ti: k3-udma-private: Fix refcount leak bug in of_xudma_dev…
Browse files Browse the repository at this point in the history
…_get()

[ Upstream commit f9fdb0b ]

We should call of_node_put() for the reference returned by
of_parse_phandle() in fail path or when it is not used anymore.
Here we only need to move the of_node_put() before the check.

Fixes: d702419 ("dmaengine: ti: k3-udma: Add glue layer for non DMAengine users")
Signed-off-by: Liang He <windhl@126.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20220720073234.1255474-1-windhl@126.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
windhl authored and gregkh committed Sep 28, 2022
1 parent 869c94d commit a17df55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/dma/ti/k3-udma-private.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property)
}

pdev = of_find_device_by_node(udma_node);
if (np != udma_node)
of_node_put(udma_node);

if (!pdev) {
pr_debug("UDMA device not found\n");
return ERR_PTR(-EPROBE_DEFER);
}

if (np != udma_node)
of_node_put(udma_node);

ud = platform_get_drvdata(pdev);
if (!ud) {
pr_debug("UDMA has not been probed\n");
Expand Down

0 comments on commit a17df55

Please sign in to comment.