Commit 1c78f19c authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Mauro Carvalho Chehab

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: df330515 ("[media] v4l: xilinx: Add Xilinx Video IP core")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent d6a1feba
...@@ -471,7 +471,7 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) ...@@ -471,7 +471,7 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev)
{ {
struct device_node *ports; struct device_node *ports;
struct device_node *port; struct device_node *port;
int ret; int ret = 0;
ports = of_get_child_by_name(xdev->dev->of_node, "ports"); ports = of_get_child_by_name(xdev->dev->of_node, "ports");
if (ports == NULL) { if (ports == NULL) {
...@@ -481,13 +481,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) ...@@ -481,13 +481,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev)
for_each_child_of_node(ports, port) { for_each_child_of_node(ports, port) {
ret = xvip_graph_dma_init_one(xdev, port); ret = xvip_graph_dma_init_one(xdev, port);
if (ret < 0) { if (ret) {
of_node_put(port); of_node_put(port);
return ret; break;
} }
} }
return 0; of_node_put(ports);
return ret;
} }
static void xvip_graph_cleanup(struct xvip_composite_device *xdev) static void xvip_graph_cleanup(struct xvip_composite_device *xdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment