drm/mipi-dsi: Only remove child devices that match the dsi device type
Subsystems (3)
PATCH 1/1 drm/mipi-dsi: Only remove child devices that match the dsi device type
From: Chaoyi Chen <[email protected]>
This patch checks whether the device is a valid mipi_dsi_device before accessing it in mipi_dsi_remove_device_fn().
The mipi_dsi_host_unregister() assumes that all child devices of the host device are mipi_dsi_devices and uses mipi_dsi_remove_device_fn() to perform subsequent operations specific to mipi_dsi_device.
In rockchip platform, for dw-mipi-dsi-rockchip.c, it creates a dphy device, and it use the dsi host device as its parent device.
And when we call dw_mipi_dsi_remove() in dw_mipi_dsi_rockchip_remove(), mipi_dsi_host_unregister() will get such a dphy child device and treat it as an mipi_dsi_device, which will lead to a further panic.
--- drivers/gpu/drm/drm_mipi_dsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_mipi_dsi.c +6 -1
@@ -349,7 +349,12 @@ EXPORT_SYMBOL(mipi_dsi_host_register);static int mipi_dsi_remove_device_fn (struct device *dev,void *priv) { -struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); +struct mipi_dsi_device *dsi; + +if (!dev_is_mipi_dsi (dev)) +return 0 ; + + dsi =to_mipi_dsi_device (dev);if (dsi->attached)mipi_dsi_detach (dsi);
Signature · 1 line
2.51.1
Am Mittwoch, 3. Dezember 2025, 12:50:28 Mitteleuropäische Normalzeit schrieb Chaoyi Chen:
Quoted 31 lines
From: Chaoyi Chen <[email protected]>
This patch checks whether the device is a valid
mipi_dsi_devicebefore accessing it inmipi_dsi_remove_device_fn().The
mipi_dsi_host_unregister()assumes that all child devices of the host device aremipi_dsi_devicesand usesmipi_dsi_remove_device_fn()to perform subsequent operations specific tomipi_dsi_device.In rockchip platform, for
dw-mipi-dsi-rockchip.c, it creates a dphy device, and it use the dsi host device as its parent device.And when we call
dw_mipi_dsi_remove()indw_mipi_dsi_rockchip_remove(),mipi_dsi_host_unregister()will get such a dphy child device and treat it as anmipi_dsi_device, which will lead to a further panic.Signed-off-by Chaoyi Chen <[email protected]>--- drivers/gpu/drm/drm_mipi_dsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_mipi_dsi.c +0
-0@@ -349,7 +349,12 @@ EXPORT_SYMBOL(mipi_dsi_host_register);static int mipi_dsi_remove_device_fn (struct device *dev,void *priv) {
drivers/gpu/drm/drm_mipi_dsi.c EXPORT_SYMBOL(mipi_dsi_host_register); · line 360
Quoted 10 lines
drivers/gpu/drm/drm_mipi_dsi.c +6
-1-struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); +struct mipi_dsi_device *dsi; + +if (!dev_is_mipi_dsi (dev)) +return 0 ; + + dsi =to_mipi_dsi_device (dev);if (dsi->attached)mipi_dsi_detach (dsi);
This makes a lot of sense.
For people reading along:
The DSI controllers on the RK3399 uses a phy that is _inside_ the DW-DSI controller, instead of a separate IP block.
But this internal PHY can also work as a receiver for camera data for the ISP block in the RK3399.
Heiko
Hi,
Quoted 30 lines · Chaoyi Chen
From: Chaoyi Chen <[email protected]>
This patch checks whether the device is a valid
mipi_dsi_devicebefore accessing it inmipi_dsi_remove_device_fn().The
mipi_dsi_host_unregister()assumes that all child devices of the host device aremipi_dsi_devicesand usesmipi_dsi_remove_device_fn()to perform subsequent operations specific tomipi_dsi_device.In rockchip platform, for
dw-mipi-dsi-rockchip.c, it creates a dphy device, and it use the dsi host device as its parent device.And when we call
dw_mipi_dsi_remove()indw_mipi_dsi_rockchip_remove(),mipi_dsi_host_unregister()will get such a dphy child device and treat it as anmipi_dsi_device, which will lead to a further panic.Signed-off-by Chaoyi Chen <[email protected]>--- drivers/gpu/drm/drm_mipi_dsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_mipi_dsi.c +0
-0@@ -349,7 +349,12 @@ EXPORT_SYMBOL(mipi_dsi_host_register);static int mipi_dsi_remove_device_fn (struct device *dev,void *priv) {
drivers/gpu/drm/drm_mipi_dsi.c EXPORT_SYMBOL(mipi_dsi_host_register); · line 360
Quoted 10 lines
drivers/gpu/drm/drm_mipi_dsi.c +6
-1-struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); +struct mipi_dsi_device *dsi; + +if (!dev_is_mipi_dsi (dev)) +return 0 ; + + dsi =to_mipi_dsi_device (dev);if (dsi->attached)mipi_dsi_detach (dsi);
Gentle ping about this.
Thanks!
Signature · 8 lines
Best, Chaoyi _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip