diff mbox series

drm/mediatek: add exception handing in mtk_drm_probe() if component init fail

Message ID 20200909084942.2122349-1-yukuai3@huawei.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: add exception handing in mtk_drm_probe() if component init fail | expand

Commit Message

Yu Kuai Sept. 9, 2020, 8:49 a.m. UTC
mtk_ddp_comp_init() is called in a loop in mtk_drm_probe(), if it
fail, previous successive init component is not proccessed.

Thus uninitialize valid component and put their device if component
init failed.

Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>

 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Chun-Kuang Hu Sept. 14, 2020, 11:38 p.m. UTC | #1
Hi, Yu Kuai:

Yu Kuai <yukuai3@huawei.com> 於 2020年9月9日 週三 下午4:50寫道:
>
> mtk_ddp_comp_init() is called in a loop in mtk_drm_probe(), if it
> fail, previous successive init component is not proccessed.
>
> Thus uninitialize valid component and put their device if component
> init failed.

Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

>
> Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 040a8f393fe2..75a6cf231fd7 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -544,8 +544,13 @@ static int mtk_drm_probe(struct platform_device *pdev)
>         pm_runtime_disable(dev);
>  err_node:
>         of_node_put(private->mutex_node);
> -       for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
> +       for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
>                 of_node_put(private->comp_node[i]);
> +               if (private->ddp_comp[i]) {
> +                       put_device(private->ddp_comp[i]->larb_dev);
> +                       private->ddp_comp[i] = NULL;
> +               }
> +       }
>         return ret;
>  }
>
> --
> 2.25.4
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 040a8f393fe2..75a6cf231fd7 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -544,8 +544,13 @@  static int mtk_drm_probe(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 err_node:
 	of_node_put(private->mutex_node);
-	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
+	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
 		of_node_put(private->comp_node[i]);
+		if (private->ddp_comp[i]) {
+			put_device(private->ddp_comp[i]->larb_dev);
+			private->ddp_comp[i] = NULL;
+		}
+	}
 	return ret;
 }