diff mbox series

drm/mediatek: add missing put_device() call in mtk_drm_kms_init()

Message ID 20200911112119.3218073-1-yukuai3@huawei.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: add missing put_device() call in mtk_drm_kms_init() | expand

Commit Message

Yu Kuai Sept. 11, 2020, 11:21 a.m. UTC
if of_find_device_by_node() succeed, mtk_drm_kms_init() doesn't have
a corresponding put_device(). Thus add jump target to fix the exception
handling for this function implementation.

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 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

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

Yu Kuai <yukuai3@huawei.com> 於 2020年9月11日 週五 下午7:22寫道:
>
> if of_find_device_by_node() succeed, mtk_drm_kms_init() doesn't have
> a corresponding put_device(). Thus add jump target to fix the exception
> handling for this function implementation.

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 | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 040a8f393fe2..7aceace94ebf 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -165,7 +165,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
>
>         ret = drmm_mode_config_init(drm);
>         if (ret)
> -               return ret;
> +               goto put_mutex_dev;
>
>         drm->mode_config.min_width = 64;
>         drm->mode_config.min_height = 64;
> @@ -182,7 +182,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
>
>         ret = component_bind_all(drm->dev, drm);
>         if (ret)
> -               return ret;
> +               goto put_mutex_dev;
>
>         /*
>          * We currently support two fixed data streams, each optional,
> @@ -229,7 +229,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
>         }
>         if (!dma_dev->dma_parms) {
>                 ret = -ENOMEM;
> -               goto err_component_unbind;
> +               goto put_dma_dev;
>         }
>
>         ret = dma_set_max_seg_size(dma_dev, (unsigned int)DMA_BIT_MASK(32));
> @@ -256,9 +256,12 @@ static int mtk_drm_kms_init(struct drm_device *drm)
>  err_unset_dma_parms:
>         if (private->dma_parms_allocated)
>                 dma_dev->dma_parms = NULL;
> +put_dma_dev:
> +       put_device(private->dma_dev);
>  err_component_unbind:
>         component_unbind_all(drm->dev, drm);
> -
> +put_mutex_dev:
> +       put_device(private->mutex_dev);
>         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..7aceace94ebf 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -165,7 +165,7 @@  static int mtk_drm_kms_init(struct drm_device *drm)
 
 	ret = drmm_mode_config_init(drm);
 	if (ret)
-		return ret;
+		goto put_mutex_dev;
 
 	drm->mode_config.min_width = 64;
 	drm->mode_config.min_height = 64;
@@ -182,7 +182,7 @@  static int mtk_drm_kms_init(struct drm_device *drm)
 
 	ret = component_bind_all(drm->dev, drm);
 	if (ret)
-		return ret;
+		goto put_mutex_dev;
 
 	/*
 	 * We currently support two fixed data streams, each optional,
@@ -229,7 +229,7 @@  static int mtk_drm_kms_init(struct drm_device *drm)
 	}
 	if (!dma_dev->dma_parms) {
 		ret = -ENOMEM;
-		goto err_component_unbind;
+		goto put_dma_dev;
 	}
 
 	ret = dma_set_max_seg_size(dma_dev, (unsigned int)DMA_BIT_MASK(32));
@@ -256,9 +256,12 @@  static int mtk_drm_kms_init(struct drm_device *drm)
 err_unset_dma_parms:
 	if (private->dma_parms_allocated)
 		dma_dev->dma_parms = NULL;
+put_dma_dev:
+	put_device(private->dma_dev);
 err_component_unbind:
 	component_unbind_all(drm->dev, drm);
-
+put_mutex_dev:
+	put_device(private->mutex_dev);
 	return ret;
 }