[PATCH] media: Fix resource leaks in for_each_child_of_node() loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



for_each_child_of_node should have of_node_put() avoid resource leaks.

Signed-off-by: Lu Hongfei <luhongfei@xxxxxxxx>
---
 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 3 +++
 1 file changed, 3 insertions(+)
 mode change 100644 => 100755 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
index 19a4a085f73a..5a6a61d68cba
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
@@ -1128,6 +1128,7 @@ int mdp_comp_config(struct mdp_dev *mdp)
 		comp = mdp_comp_create(mdp, node, id);
 		if (IS_ERR(comp)) {
 			ret = PTR_ERR(comp);
+			of_node_put(node);
 			goto err_init_comps;
 		}
 
@@ -1137,6 +1138,8 @@ int mdp_comp_config(struct mdp_dev *mdp)
 		pm_runtime_enable(comp->comp_dev);
 	}
 
+	of_node_put(node);
+
 	ret = mdp_comp_sub_create(mdp);
 	if (ret)
 		goto err_init_comps;
-- 
2.39.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux