Commit 22ff7d4c authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Mauro Carvalho Chehab
Browse files

media: platform: mtk-mdp: mtk_mdp_core: Add of_node_put() before goto



Each iteration of for_each_child_of_node puts the previous node, but in
the case of a goto from the middle of the loop, there is no put, thus
causing a memory leak. Hence add an of_node_put before the goto in two
places.
Issue found with Coccinelle.

Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Acked-by: default avatarHoulong Wei <houlong.wei@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 4fd22938
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -147,14 +147,17 @@ static int mtk_mdp_probe(struct platform_device *pdev)
		comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
		if (!comp) {
			ret = -ENOMEM;
			of_node_put(node);
			goto err_comp;
		}
		mdp->comp[comp_id] = comp;

		ret = mtk_mdp_comp_init(dev, node, comp, comp_id);
		if (ret)
		if (ret) {
			of_node_put(node);
			goto err_comp;
		}
	}

	mdp->job_wq = create_singlethread_workqueue(MTK_MDP_MODULE_NAME);
	if (!mdp->job_wq) {