From: monk.liu Date: Wed, 12 Aug 2015 09:56:52 +0000 (+0800) Subject: drm/amdgpu: fix type mismatch error X-Git-Tag: v4.3-rc1~75^2~22^2~9 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a8f5bf0b220c28b1b600a5ff3cae0b53c5c2079b;p=karo-tx-linux.git drm/amdgpu: fix type mismatch error remaining timeout returned by amdgpu_fence_wait_any can be larger than max int value, thus the truncated 32 bit value in r ends up being negative while its original long value is positive. Signed-off-by: monk.liu Reviewed-by: Michel Dänzer Reviewed-by: Christian König Reviewed-by: Jammy Zhou --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index c5b17262529d..d6398cf45f24 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c @@ -318,6 +318,7 @@ int amdgpu_sa_bo_new(struct amdgpu_device *adev, struct amdgpu_fence *fences[AMDGPU_MAX_RINGS]; unsigned tries[AMDGPU_MAX_RINGS]; int i, r; + signed long t; BUG_ON(align > sa_manager->align); BUG_ON(size > sa_manager->size); @@ -351,8 +352,8 @@ int amdgpu_sa_bo_new(struct amdgpu_device *adev, } while (amdgpu_sa_bo_next_hole(sa_manager, fences, tries)); spin_unlock(&sa_manager->wq.lock); - r = amdgpu_fence_wait_any(adev, fences, false, MAX_SCHEDULE_TIMEOUT); - r = (r > 0) ? 0 : r; + t = amdgpu_fence_wait_any(adev, fences, false, MAX_SCHEDULE_TIMEOUT); + r = (t > 0) ? 0 : t; spin_lock(&sa_manager->wq.lock); /* if we have nothing to wait for block */ if (r == -ENOENT) {