From: Colin Ian King Date: Thu, 22 Apr 2021 12:31:58 +0000 (+0100) Subject: drm/amdkfd: fix uint32 variable compared to less than zero X-Git-Tag: v5.14-rc1~114^2~21^2~165 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65f8db8150ee30623cd6b870d6f836c4339026a5;p=thirdparty%2Fkernel%2Flinux.git drm/amdkfd: fix uint32 variable compared to less than zero Currently the call to kfd_process_gpuidx_from_gpuid is returning an int value and this is being assigned to a uint32_t variable gpuidx and this is being checked for a negative error return which is always going to be false. Fix this by making gpuidx an int32_t. This makes gpuidx also type consistent with the use of gpuidx from the callers. Addresses-Coverity: ("Unsigned compared against 0") Fixes: cda0f85bfa5e ("drm/amdkfd: refine migration policy with xnack on") Signed-off-by: Colin Ian King Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index cfd8065fe0f64..4cc2539bed5b1 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -1330,7 +1330,7 @@ static void svm_range_unreserve_bos(struct svm_validate_context *ctx) */ static int svm_range_validate_and_map(struct mm_struct *mm, struct svm_range *prange, - uint32_t gpuidx, bool intr, bool wait) + int32_t gpuidx, bool intr, bool wait) { struct svm_validate_context ctx; struct hmm_range *hmm_range;