After a connector is added to the drm_mode_config::connector_list, it's
visible to any in-kernel users looking up connectors via the above list.
Make sure that the connector is properly initialized before such
look-ups, by initializing the connector with
drm_connector_dynamic_register() - which doesn't add the connector to
the list - and registering it with drm_connector_dynamic_register() -
which adds the connector to the list - after the initialization is
complete.

Cc: Karol Herbst <kher...@redhat.com>
Cc: Lyude Paul <ly...@redhat.com>
Cc: Danilo Krummrich <d...@kernel.org>
Signed-off-by: Imre Deak <imre.d...@intel.com>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index eed579a6c858b..8097249612bc7 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -1265,8 +1265,8 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct 
drm_dp_mst_port *port,
        mstc->mstm = mstm;
        mstc->port = port;
 
-       ret = drm_connector_init(dev, &mstc->connector, &nv50_mstc,
-                                DRM_MODE_CONNECTOR_DisplayPort);
+       ret = drm_connector_dynamic_init(dev, &mstc->connector, &nv50_mstc,
+                                        DRM_MODE_CONNECTOR_DisplayPort, NULL);
        if (ret) {
                kfree(*pmstc);
                *pmstc = NULL;
-- 
2.44.2

Reply via email to