drm/amdkfd: Handle case of invalid queue type
authorOded Gabbay <oded.gabbay@amd.com>
Thu, 22 Jan 2015 09:40:06 +0000 (11:40 +0200)
committerOded Gabbay <oded.gabbay@amd.com>
Thu, 22 Jan 2015 10:43:42 +0000 (12:43 +0200)
This patch handles a case where amdkfd tries to destroy a queue but the queue
type is invalid.
This case occurs in non-HWS path.

Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c

index 85387c8..99e2dbb 100644 (file)
@@ -301,6 +301,11 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm,
                }
                dqm->sdma_queue_count--;
                deallocate_sdma_queue(dqm, q->sdma_id);
+       } else {
+               pr_debug("q->properties.type is invalid (%d)\n",
+                               q->properties.type);
+               retval = -EINVAL;
+               goto out;
        }
 
        retval = mqd->destroy_mqd(mqd, q->mqd,