On Tue, Nov 17, 2026 at 12:59:02PM -0800, Henry Zhang wrote: > The DSI encoder is embedded in struct vc4_dsi, which lives as long as > the DSI platform device That's not true. It's allocated with devm_drm_bridge_alloc() that will *not* free it in remove but give away its reference there. We have another reference taken in vc4_dsi_bind, that is only given up through a drm-managed action and thus will only be freed when the DRM device is destroyed. > but it is initialised with drmm_encoder_init() and so is only cleaned > up when the DRM device is released. The DRM device can outlive the > unbind of the vc4 components: unloading the DSI panel driver detaches > from the DSI host, which deletes the DSI component and unbinds the > whole vc4 DRM device, but a compositor that keeps the DRM device open > keeps it alive. All vc4 components should be tied to the DRM device lifetime so that's not generally correct either. Something might have snuck back in though. Also, generally speaking, unloading panel drivers is unsupported at this point. It's a work in progress, but requires more changes to be safe. > If the panel driver is loaded again before that, the new DRM device > binds the DSI component and calls drmm_encoder_init() on the encoder > that is still on the old DRM device's encoder list. The old device's > release later cleans it up from under the new one. On a Raspberry Pi 4 > with a 6.18-based kernel, closing the old DRM device then gave: > > WARNING: drivers/gpu/drm/drm_encoder.c:214 at drmm_encoder_alloc_release+0x30/0x40 [drm] > Call trace: drmm_encoder_alloc_release <- drm_dev_put <- drm_gem_dmabuf_release <- __fput > Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 > pc : drm_mode_config_cleanup+0x5c/0x2f0 [drm] > Call trace: drm_mode_config_cleanup <- drm_managed_release <- drm_dev_put This is surprising though. I'd like to see a detailed analysis of what's actually going on on mainline because it doesn't look right. Maxime