[PATCH] drm/mipi-dsi: Fix devm unregister & detach

Maxime Ripard mripard at kernel.org
Wed Jun 26 08:49:47 UTC 2024


Hi,

On Wed, Jun 19, 2024 at 12:07:48PM GMT, Tomi Valkeinen wrote:
> From: Tomi Valkeinen <tomi.valkeinen+renesas at ideasonboard.com>
> 
> When a bridge driver uses devm_mipi_dsi_device_register_full() or
> devm_mipi_dsi_attach(), the resource management is moved to devres,
> which releases the resource automatically when the bridge driver is
> unbound.
> 
> However, if the DSI host goes away first, the host unregistration code
> will automatically detach and unregister any DSI peripherals, without
> notifying the devres about it. So when the bridge driver later is
> unbound, the resources are released a second time, leading to crash.

That's super surprising. mipi_dsi_device_unregister calls
device_unregister, which calls device_del, which in turn calls
devres_release_all.

If that doesn't work like that, then it's what needs to be fixed, and
not worked around in the MIPI-DSI bus.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20240626/f5af30d8/attachment.sig>


More information about the dri-devel mailing list