aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorGraham Sider2022-05-12 14:34:22 -0400
committerAlex Deucher2022-05-16 10:02:58 -0400
commit04fd07397efda804977778629f5fa408dcb78369 (patch)
tree86bcaa2b05678303cd5e548b18a7a1b179c22b9b /drivers/gpu
parent4b9caaa0281972ca5ea4e1cdac2e12b9df1ae00b (diff)
drm/amdkfd: Fix static checker warning on MES queue type
convert_to_mes_queue_type return can be negative, but queue_input.queue_type is uint32_t. Put return in integer var and cast to unsigned after negative check. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Graham Sider <Graham.Sider@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index e9c9a3a67ab0..e1797657b04c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -176,7 +176,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev;
struct kfd_process_device *pdd = qpd_to_pdd(qpd);
struct mes_add_queue_input queue_input;
- int r;
+ int r, queue_type;
if (dqm->is_hws_hang)
return -EIO;
@@ -201,12 +201,13 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
queue_input.tba_addr = qpd->tba_addr;
queue_input.tma_addr = qpd->tma_addr;
- queue_input.queue_type = convert_to_mes_queue_type(q->properties.type);
- if (queue_input.queue_type < 0) {
+ queue_type = convert_to_mes_queue_type(q->properties.type);
+ if (queue_type < 0) {
pr_err("Queue type not supported with MES, queue:%d\n",
q->properties.type);
return -EINVAL;
}
+ queue_input.queue_type = (uint32_t)queue_type;
if (q->gws) {
queue_input.gws_base = 0;