Commit fa220c05 authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Mathieu Poirier

remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init

Every iteration of for_each_available_child_of_node() decrements
the reference count of the previous node.
When breaking early from a for_each_available_child_of_node() loop,
we need to explicitly call of_node_put() on the child node.
Add missing of_node_put() to avoid refcount leak.

Fixes: 6dedbd1d ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Acked-by: default avatarSuman Anna <s-anna@ti.com>
Link: https://lore.kernel.org/r/20220605083334.23942-1-linmq006@gmail.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent b13baccc
...@@ -1655,6 +1655,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev) ...@@ -1655,6 +1655,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev)
if (!cpdev) { if (!cpdev) {
ret = -ENODEV; ret = -ENODEV;
dev_err(dev, "could not get R5 core platform device\n"); dev_err(dev, "could not get R5 core platform device\n");
of_node_put(child);
goto fail; goto fail;
} }
...@@ -1663,6 +1664,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev) ...@@ -1663,6 +1664,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev)
dev_err(dev, "k3_r5_core_of_init failed, ret = %d\n", dev_err(dev, "k3_r5_core_of_init failed, ret = %d\n",
ret); ret);
put_device(&cpdev->dev); put_device(&cpdev->dev);
of_node_put(child);
goto fail; goto fail;
} }
......
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