drm/amd/display: fix access hdcp_workqueue assert
authorjsg <jsg@openbsd.org>
Thu, 24 Aug 2023 06:15:44 +0000 (06:15 +0000)
committerjsg <jsg@openbsd.org>
Thu, 24 Aug 2023 06:15:44 +0000 (06:15 +0000)
From Hersen Wu
402f1d86ea26c160841da4eb46b0ad8606ab52b3 in linux-6.1.y/6.1.47
cdff36a0217aadf5cbc167893ad1c0da869619cb in mainline linux

sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c
sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

index c3991a1..2186348 100644 (file)
@@ -8376,6 +8376,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
                struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
 
+               if (!adev->dm.hdcp_workqueue)
+                       continue;
+
                pr_debug("[HDCP_DM] -------------- i : %x ----------\n", i);
 
                if (!connector)
@@ -8424,6 +8427,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
                struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
 
+               if (!adev->dm.hdcp_workqueue)
+                       continue;
+
                new_crtc_state = NULL;
                old_crtc_state = NULL;
 
index 9884dd7..a9ddff7 100644 (file)
@@ -379,13 +379,17 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
                if (aconnector->dc_sink && connector->state) {
                        struct drm_device *dev = connector->dev;
                        struct amdgpu_device *adev = drm_to_adev(dev);
-                       struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue;
-                       struct hdcp_workqueue *hdcp_w = &hdcp_work[aconnector->dc_link->link_index];
 
-                       connector->state->hdcp_content_type =
-                       hdcp_w->hdcp_content_type[connector->index];
-                       connector->state->content_protection =
-                       hdcp_w->content_protection[connector->index];
+                       if (adev->dm.hdcp_workqueue) {
+                               struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue;
+                               struct hdcp_workqueue *hdcp_w =
+                                       &hdcp_work[aconnector->dc_link->link_index];
+
+                               connector->state->hdcp_content_type =
+                               hdcp_w->hdcp_content_type[connector->index];
+                               connector->state->content_protection =
+                               hdcp_w->content_protection[connector->index];
+                       }
                }
 #endif