drm/amdgpu: always bind pinned BOs
authorChristian König <christian.koenig@amd.com>
Fri, 20 Oct 2017 11:12:12 +0000 (13:12 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Dec 2017 21:33:15 +0000 (16:33 -0500)
We always need to bind pinned BOs, not just when the caller requested the
address.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index 8a103303da3e3a9b6ed97068a25aba816e276f91..6f876deaafc694f2e2d50e46eb69de38d4517ab4 100644 (file)
@@ -688,15 +688,15 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                goto error;
        }
 
+       r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+       if (unlikely(r)) {
+               dev_err(adev->dev, "%p bind failed\n", bo);
+               goto error;
+       }
+
        bo->pin_count = 1;
-       if (gpu_addr != NULL) {
-               r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
-               if (unlikely(r)) {
-                       dev_err(adev->dev, "%p bind failed\n", bo);
-                       goto error;
-               }
+       if (gpu_addr != NULL)
                *gpu_addr = amdgpu_bo_gpu_offset(bo);
-       }
 
        domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
        if (domain == AMDGPU_GEM_DOMAIN_VRAM) {