Skip to content

Commit 94c9337

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: mtk_drm_drv: Unbind secondary mmsys components on err
When calling component_bind_all(), if a component that is included in the list fails, all of those that have been successfully bound will be unbound, but this driver has two components lists for two actual devices, as in, each mmsys instance has its own components list. In case mmsys0 (or actually vdosys0) is able to bind all of its components, but the secondary one fails, all of the components of the first are kept bound, while the ones of mmsys1/vdosys1 are correctly cleaned up. This is not right because, in case of a failure, the components are re-bound for all of the mmsys/vdosys instances without caring about the ones that were previously left in a bound state. Fix that by calling component_unbind_all() on all of the previous component masters that succeeded binding all subdevices when any of the other masters errors out. Fixes: 1ef7ed4 ("drm/mediatek: Modify mediatek-drm for mt8195 multi mmsys support") Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 80805b6 commit 94c9337

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,11 @@ static int mtk_drm_kms_init(struct drm_device *drm)
488488
for (i = 0; i < private->data->mmsys_dev_num; i++) {
489489
drm->dev_private = private->all_drm_private[i];
490490
ret = component_bind_all(private->all_drm_private[i]->dev, drm);
491-
if (ret)
491+
if (ret) {
492+
while (--i >= 0)
493+
component_unbind_all(private->all_drm_private[i]->dev, drm);
492494
return ret;
495+
}
493496
}
494497

495498
/*

0 commit comments

Comments
 (0)