Skip to content

Commit f9fdb0b

Browse files
windhlvinodkoul
authored andcommitted
dmaengine: ti: k3-udma-private: Fix refcount leak bug in of_xudma_dev_get()
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 <[email protected]> Acked-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 8f2b6bc commit f9fdb0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/dma/ti/k3-udma-private.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property)
3131
}
3232

3333
pdev = of_find_device_by_node(udma_node);
34+
if (np != udma_node)
35+
of_node_put(udma_node);
36+
3437
if (!pdev) {
3538
pr_debug("UDMA device not found\n");
3639
return ERR_PTR(-EPROBE_DEFER);
3740
}
3841

39-
if (np != udma_node)
40-
of_node_put(udma_node);
41-
4242
ud = platform_get_drvdata(pdev);
4343
if (!ud) {
4444
pr_debug("UDMA has not been probed\n");

0 commit comments

Comments
 (0)