Commit 458a3952 authored by Amitoj Kaur Chawla's avatar Amitoj Kaur Chawla Committed by Mauro Carvalho Chehab

[media] media: platform: exynos4-is: media-dev: Add missing of_node_put

for_each_available_child_of_node and for_each_child_of_node perform an
of_node_get on each iteration, so to break out of the loop an of_node_put is
required.

Found using Coccinelle. The simplified version of the semantic patch
that is used for this is as follows:

// <smpl>
@@
local idexpression n;
expression e,r;
@@

 for_each_available_child_of_node(r,n) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  break;
)
   ...
 }
... when != n
// </smpl>
Signed-off-by: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 0ede1876
...@@ -435,8 +435,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) ...@@ -435,8 +435,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
continue; continue;
ret = fimc_md_parse_port_node(fmd, port, index); ret = fimc_md_parse_port_node(fmd, port, index);
if (ret < 0) if (ret < 0) {
of_node_put(node);
goto rpm_put; goto rpm_put;
}
index++; index++;
} }
...@@ -447,8 +449,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) ...@@ -447,8 +449,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
for_each_child_of_node(ports, node) { for_each_child_of_node(ports, node) {
ret = fimc_md_parse_port_node(fmd, node, index); ret = fimc_md_parse_port_node(fmd, node, index);
if (ret < 0) if (ret < 0) {
of_node_put(node);
break; break;
}
index++; index++;
} }
rpm_put: rpm_put:
...@@ -656,9 +660,11 @@ static int fimc_md_register_platform_entities(struct fimc_md *fmd, ...@@ -656,9 +660,11 @@ static int fimc_md_register_platform_entities(struct fimc_md *fmd,
ret = fimc_md_register_platform_entity(fmd, pdev, ret = fimc_md_register_platform_entity(fmd, pdev,
plat_entity); plat_entity);
put_device(&pdev->dev); put_device(&pdev->dev);
if (ret < 0) if (ret < 0) {
of_node_put(node);
break; break;
} }
}
return ret; return ret;
} }
......
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