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

From: Luca Ceresoli

Date: Mon Nov 30 2026 - 12:30:46 EST


> 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.

Luca

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