linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init()
@ 2020-09-05  8:30 Yu Kuai
  2020-09-07 22:56 ` Chun-Kuang Hu
  2020-09-14 23:37 ` Chun-Kuang Hu
  0 siblings, 2 replies; 4+ messages in thread
From: Yu Kuai @ 2020-09-05  8:30 UTC (permalink / raw)
  To: chunkuang.hu, p.zabel, airlied, daniel, matthias.bgg, yt.shen,
	ck.hu, bibby.hsieh, yongqiang.niu
  Cc: dri-devel, linux-arm-kernel, linux-mediatek, linux-kernel,
	yukuai3, yi.zhang

if of_find_device_by_node() succeed, mtk_ddp_comp_init() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.

Fixes: d0afe37f5209 ("drm/mediatek: support CMDQ interface in ddp component")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 57c88de9a329..526648885b97 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -496,6 +496,7 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
 #if IS_REACHABLE(CONFIG_MTK_CMDQ)
 	if (of_address_to_resource(node, 0, &res) != 0) {
 		dev_err(dev, "Missing reg in %s node\n", node->full_name);
+		put_device(&larb_pdev->dev);
 		return -EINVAL;
 	}
 	comp->regs_pa = res.start;
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init()
  2020-09-05  8:30 [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init() Yu Kuai
@ 2020-09-07 22:56 ` Chun-Kuang Hu
  2020-09-08  1:05   ` yukuai (C)
  2020-09-14 23:37 ` Chun-Kuang Hu
  1 sibling, 1 reply; 4+ messages in thread
From: Chun-Kuang Hu @ 2020-09-07 22:56 UTC (permalink / raw)
  To: Yu Kuai
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, yt.shen, CK Hu, Bibby Hsieh, Yongqiang Niu,
	DRI Development, Linux ARM,
	moderated list:ARM/Mediatek SoC support, linux-kernel, yi.zhang

Hi Yu Kuai:

Yu Kuai <yukuai3@huawei.com> 於 2020年9月5日 週六 下午4:31寫道:
>
> if of_find_device_by_node() succeed, mtk_ddp_comp_init() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the exception
> handling for this function implementation.
>

This patch looks good to me, but I find another thing related to this.
mtk_ddp_comp_init() is called in a loop in mtk_drm_probe(), when this
component init fail, I think we should uninitialize previous
successive init component and put their device. Would you like to make
this patch more complete?

Regards,
Chun-Kuang.

> Fixes: d0afe37f5209 ("drm/mediatek: support CMDQ interface in ddp component")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 57c88de9a329..526648885b97 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -496,6 +496,7 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
>  #if IS_REACHABLE(CONFIG_MTK_CMDQ)
>         if (of_address_to_resource(node, 0, &res) != 0) {
>                 dev_err(dev, "Missing reg in %s node\n", node->full_name);
> +               put_device(&larb_pdev->dev);
>                 return -EINVAL;
>         }
>         comp->regs_pa = res.start;
> --
> 2.25.4
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init()
  2020-09-07 22:56 ` Chun-Kuang Hu
@ 2020-09-08  1:05   ` yukuai (C)
  0 siblings, 0 replies; 4+ messages in thread
From: yukuai (C) @ 2020-09-08  1:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	yt.shen, CK Hu, Bibby Hsieh, Yongqiang Niu, DRI Development,
	Linux ARM, moderated list:ARM/Mediatek SoC support, linux-kernel,
	yi.zhang

On 2020/09/08 6:56, Chun-Kuang Hu wrote:
> Hi Yu Kuai:
> 
> Yu Kuai <yukuai3@huawei.com> 於 2020年9月5日 週六 下午4:31寫道:
>>
>> if of_find_device_by_node() succeed, mtk_ddp_comp_init() doesn't have
>> a corresponding put_device(). Thus add put_device() to fix the exception
>> handling for this function implementation.
>>
> 
> This patch looks good to me, but I find another thing related to this.
> mtk_ddp_comp_init() is called in a loop in mtk_drm_probe(), when this
> component init fail, I think we should uninitialize previous
> successive init component and put their device. Would you like to make
> this patch more complete?

Hi,

Of course, thank you for your review.

Best regards,
Yu Kuai


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init()
  2020-09-05  8:30 [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init() Yu Kuai
  2020-09-07 22:56 ` Chun-Kuang Hu
@ 2020-09-14 23:37 ` Chun-Kuang Hu
  1 sibling, 0 replies; 4+ messages in thread
From: Chun-Kuang Hu @ 2020-09-14 23:37 UTC (permalink / raw)
  To: Yu Kuai
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, yt.shen, CK Hu, Bibby Hsieh, Yongqiang Niu,
	DRI Development, Linux ARM,
	moderated list:ARM/Mediatek SoC support, linux-kernel, yi.zhang

Hi, Yu Kuai:

Yu Kuai <yukuai3@huawei.com> 於 2020年9月5日 週六 下午4:31寫道:
>
> if of_find_device_by_node() succeed, mtk_ddp_comp_init() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the exception
> handling for this function implementation.
>

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

> Fixes: d0afe37f5209 ("drm/mediatek: support CMDQ interface in ddp component")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 57c88de9a329..526648885b97 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -496,6 +496,7 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
>  #if IS_REACHABLE(CONFIG_MTK_CMDQ)
>         if (of_address_to_resource(node, 0, &res) != 0) {
>                 dev_err(dev, "Missing reg in %s node\n", node->full_name);
> +               put_device(&larb_pdev->dev);
>                 return -EINVAL;
>         }
>         comp->regs_pa = res.start;
> --
> 2.25.4
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-14 23:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05  8:30 [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init() Yu Kuai
2020-09-07 22:56 ` Chun-Kuang Hu
2020-09-08  1:05   ` yukuai (C)
2020-09-14 23:37 ` Chun-Kuang Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).