回复: [PATCH v5 2/2] drm/komeda: Use drmm_mode_config_init()

From: Luo Liu

Date: Mon Nov 30 2026 - 21:29:37 EST


Hello Luca,

Thank you very much for your review and suggestions.

> -----邮件原件-----
> 发件人: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>
> 发送时间: 2026年12月1日 1:30
> 收件人: Luo Liu <Luo.Liu@xxxxxxxxxxx>
> 抄送: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>; Maxime
> Ripard <mripard@xxxxxxxxxx>; Thomas Zimmermann
> <tzimmermann@xxxxxxx>; Liviu Dudau <liviu.dudau@xxxxxxx>; Russell King
> <linux@xxxxxxxxxxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx; Ayan Halder
> <Ayan.Halder@xxxxxxx>; Andrzej Hajda <andrzej.hajda@xxxxxxxxx>; Neil
> Armstrong <neil.armstrong@xxxxxxxxxx>; Robert Foss <rfoss@xxxxxxxxxx>;
> Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>; Jonas Karlman
> <jonas@xxxxxxxxx>; Jernej Skrabec <jernej.skrabec@xxxxxxxxx>; Kory
> Maincent <kory.maincent@xxxxxxxxxxx>; Luca Ceresoli
> <luca.ceresoli@xxxxxxxxxxx>; David Airlie <airlied@xxxxxxxxx>; Simona Vetter
> <simona@xxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; cix-kernel-upstream
> <cix-kernel-upstream@xxxxxxxxxxx>; Wuyi Shen (沈武义)
> <Wuyi.Shen@xxxxxxxxxxx>
> 主题: Re: [PATCH v5 2/2] drm/komeda: Use drmm_mode_config_init()
>
> [Some people who received this message don't often get email from
> luca.ceresoli@xxxxxxxxxxx. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> EXTERNAL EMAIL
>
> > drm_bridge_connector_init() creates the connector with
> > drmm_connector_init(), which does not allow a ->destroy hook and
> > registers its own cleanup action instead. Calling
> > drm_mode_config_cleanup() explicitly drops the connector's last
> > reference, so drm_connector_free() ends up calling a NULL ->destroy
> > pointer. That happens on the
> > komeda_kms_attach() error paths, and on unbind as soon as no other
> > component holds a connector reference.
> >
> > Let DRM release the mode configuration: switch to
> > drmm_mode_config_init() and drop the explicit
> > drm_mode_config_cleanup() calls. The managed cleanup is registered
> > before the connectors are created, so it runs after the connector cleanup
> actions and finds an empty connector list.
> >
> > The mode configuration teardown now happens after komeda_kms_detach()
> > has returned, so komeda can no longer rely on
> > drm_mode_config_cleanup() detaching the encoders' bridges before
> > komeda_kms_cleanup_private_objs() walks mode_config.privobj_list - the
> > bridges are private objects there as well, and finalizing them a
> > second time when the encoders are cleaned up would corrupt the list
> > and free their state twice. Since the komeda private objects belong to
> > the pipeline components, finalize them by walking the pipelines instead of the
> shared list.
> >
> > Signed-off-by: Luo Liu <Luo.Liu@xxxxxxxxxxx>
>
> Based on your description, it looks like patch 1 breaks something and this patch
> fixes it. Shouldn't the two patches be swapped, with this one first as a
> preparation step before switching to the bridge connector?
>
> Also, this patch does not apply due to a trivial conflict. Please ensure you rebase
> on top of drm-misc/drm-misc-next before sending feature patches.
>
> Otherwise looks OK.

Sorry for the conflict, I will rebase on drm-misc/drm-misc-next, and I will also swap the first two patches as
you suggested. Patch 2 will be reworded as a preparation for the connector switch, so it no longer reads as a
fix for a problem it introduces.

Best regards,
Luo

> Luca
>
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com