Skip to content

Commit 1c78f19

Browse files
Yuuoniymchehab
authored andcommitted
media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init
of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: df33051 ("[media] v4l: xilinx: Add Xilinx Video IP core") Signed-off-by: Miaoqian Lin <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent d6a1feb commit 1c78f19

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/media/platform/xilinx/xilinx-vipp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev)
471471
{
472472
struct device_node *ports;
473473
struct device_node *port;
474-
int ret;
474+
int ret = 0;
475475

476476
ports = of_get_child_by_name(xdev->dev->of_node, "ports");
477477
if (ports == NULL) {
@@ -481,13 +481,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev)
481481

482482
for_each_child_of_node(ports, port) {
483483
ret = xvip_graph_dma_init_one(xdev, port);
484-
if (ret < 0) {
484+
if (ret) {
485485
of_node_put(port);
486-
return ret;
486+
break;
487487
}
488488
}
489489

490-
return 0;
490+
of_node_put(ports);
491+
return ret;
491492
}
492493

493494
static void xvip_graph_cleanup(struct xvip_composite_device *xdev)

0 commit comments

Comments
 (0)