Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"mhun512@gmail.com" <mhun512@gmail.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "ae878000@gmail.com" <ae878000@gmail.com>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] drm/mediatek: ovl_adaptor: balance component registrations
Date: Tue, 28 Jul 2026 09:28:44 +0000	[thread overview]
Message-ID: <7238da113aa85cf19c1cabf73911f4b7149c18f9.camel@mediatek.com> (raw)
In-Reply-To: <20260721152242.47138-1-mhun512@gmail.com>

On Wed, 2026-07-22 at 00:22 +0900, Myeonghun Pak wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> The OVL adaptor registers both an aggregate driver for its child devices
> and a component for the main DRM aggregate. Probe currently ignores an
> error from registering the child aggregate and leaves that aggregate
> registered if registering the DRM component fails. The remove callback
> also leaves the DRM component registered.
> 
> These imbalances can leave component framework entries referring to a
> device whose probe failed or whose driver has been detached. The aggregate
> unbind callback also fails to undo component_bind_all(), leaving its child
> components marked as bound when the aggregate is removed.
> 
> Check the aggregate registration result, unwind it when the component
> registration fails, and unregister the component before the aggregate on
> remove. Keep runtime PM enabled until both framework registrations have
> been removed, and unbind all child components from the aggregate unbind
> callback.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Fixes: 453c3364632a ("drm/mediatek: Add ovl_adaptor support for MT8195")
> Cc: stable@vger.kernel.org # 6.4+
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> index c0af3e3b5..6a259872b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> @@ -625,6 +625,7 @@ static void mtk_disp_ovl_adaptor_master_unbind(struct device *dev)
>         struct mtk_disp_ovl_adaptor *priv = dev_get_drvdata(dev);
> 
>         priv->children_bound = false;
> +       component_unbind_all(dev, priv->mmsys_dev);
>  }
> 
>  static const struct component_master_ops mtk_disp_ovl_adaptor_master_ops = {
> @@ -651,12 +652,15 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev)
> 
>         priv->mmsys_dev = pdev->dev.platform_data;
> 
> -       component_master_add_with_match(dev, &mtk_disp_ovl_adaptor_master_ops, match);
> +       ret = component_master_add_with_match(dev, &mtk_disp_ovl_adaptor_master_ops, match);
> +       if (ret)
> +               return dev_err_probe(dev, ret, "Failed to add component master\n");
> 
>         pm_runtime_enable(dev);
> 
>         ret = component_add(dev, &mtk_disp_ovl_adaptor_comp_ops);
>         if (ret != 0) {
> +               component_master_del(dev, &mtk_disp_ovl_adaptor_master_ops);
>                 pm_runtime_disable(dev);
>                 return dev_err_probe(dev, ret, "Failed to add component\n");
>         }
> @@ -666,6 +670,7 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev)
> 
>  static void mtk_disp_ovl_adaptor_remove(struct platform_device *pdev)
>  {
> +       component_del(&pdev->dev, &mtk_disp_ovl_adaptor_comp_ops);
>         component_master_del(&pdev->dev, &mtk_disp_ovl_adaptor_master_ops);
>         pm_runtime_disable(&pdev->dev);
>  }
> --
> 2.51.0


      reply	other threads:[~2026-07-28  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 15:22 [PATCH] drm/mediatek: ovl_adaptor: balance component registrations Myeonghun Pak
2026-07-28  9:28 ` CK Hu (胡俊光) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7238da113aa85cf19c1cabf73911f4b7149c18f9.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=ae878000@gmail.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mhun512@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox