drm/amdgpu: Fix one list corruption when create queue fails
authorxinhui pan <xinhui.pan@amd.com>
Thu, 7 Jul 2022 10:20:00 +0000 (18:20 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2022 19:55:56 +0000 (15:55 -0400)
Queue would be freed when create_queue_cpsch fails
So lets do queue cleanup otherwise various list and memory issues
happen.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c

index 93a0b69954309576db62cbadad08fb0ed64707a4..e83725a281068b74ffa7d5f5870826329ce7e8e3 100644 (file)
@@ -1674,14 +1674,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
        if (q->properties.is_active) {
                increment_queue_count(dqm, qpd, q);
 
-               if (!dqm->dev->shared_resources.enable_mes) {
+               if (!dqm->dev->shared_resources.enable_mes)
                        retval = execute_queues_cpsch(dqm,
-                                            KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0);
-               } else {
+                                       KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0);
+               else
                        retval = add_queue_mes(dqm, q, qpd);
-                       if (retval)
-                               goto cleanup_queue;
-               }
+               if (retval)
+                       goto cleanup_queue;
        }
 
        /*