Skip to content

Commit f708e8b

Browse files
javiercarrascocruzChun-Kuang Hu
authored andcommitted
drm/mediatek: Fix child node refcount handling in early exit
Early exits (goto, break, return) from for_each_child_of_node() required an explicit call to of_node_put(), which was not introduced with the break if cnt == MAX_CRTC. Add the missing of_node_put() before the break. Cc: stable@vger.kernel.org Fixes: d761b94 ("drm/mediatek: Add cnt checking for coverity issue") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: CK Hu <ck.hu@mediatek.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20241011-mtk_drm_drv_memleak-v1-1-2b40c74c8d75@gmail.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 4c93284 commit f708e8b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,10 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
406406
if (temp_drm_priv->mtk_drm_bound)
407407
cnt++;
408408

409-
if (cnt == MAX_CRTC)
409+
if (cnt == MAX_CRTC) {
410+
of_node_put(node);
410411
break;
412+
}
411413
}
412414

413415
if (drm_priv->data->mmsys_dev_num == cnt) {

0 commit comments

Comments
 (0)