Thread (2 messages) 2 messages, 2 authors, 2026-02-25

Re: [PATCH v2] drm/mediatek: dsi: Store driver data before invoking mipi_dsi_host_register

From: CK Hu (胡俊光) <hidden>
Date: 2026-02-25 02:08:04
Also in: dri-devel, linux-mediatek, lkml

On Mon, 2026-02-23 at 14:16 +0000, Luca Leonardo Scorcia wrote:
External email : Please do not click links or open attachments until you have verified the sender or the content.


The call to mipi_dsi_host_register triggers a callback to mtk_dsi_bind,
which uses dev_get_drvdata to retrieve the mtk_dsi struct, so this
structure needs to be stored inside the driver data before invoking it.

As drvdata is currently uninitialized it leads to a crash when
registering the DSI DRM encoder right after acquiring
the mode_config.idr_mutex, blocking all subsequent DRM operations.
[snip]
quoted hunk ↗ jump to hunk
 drivers/gpu/drm/mediatek/mtk_dsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d7726091819c..af4871de9e4c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1232,6 +1232,8 @@ static int mtk_dsi_probe(struct platform_device *pdev)

        dsi->host.ops = &mtk_dsi_ops;
        dsi->host.dev = dev;
+       platform_set_drvdata(pdev, dsi);
+
        ret = mipi_dsi_host_register(&dsi->host);
        if (ret < 0)
                return dev_err_probe(dev, ret, "Failed to register DSI host\n");
@@ -1245,8 +1247,6 @@ static int mtk_dsi_probe(struct platform_device *pdev)

        init_waitqueue_head(&dsi->irq_wait_queue);
I would like all struct dsi setting done before platform_set_drvdata().
So move init_waitqueue_head() before platform_set_drvdata().

Regards,
CK
-       platform_set_drvdata(pdev, dsi);
-
        dsi->bridge.of_node = dev->of_node;
        dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;

--
2.43.0
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help