aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-11-17 06:16:34 -0500
committerAlex Deucher <alexander.deucher@amd.com>2016-11-23 15:08:44 -0500
commitc3af1258a7c784fba6863357b94e31a6824aaff9 (patch)
treed6b915dd1091d54beea1d102a2e670ed3393ac0d
parentf29224a6197dc71a7f3c557f41ae56c58192c345 (diff)
drm/amdgpu: fix error handling in amdgpu_bo_create_restricted
Manually checking why a function could fail is not a good idea if you can just check the functions return code. 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>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 4368a0467bdc..611da3bd2981 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -382,12 +382,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
382 bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) { 382 bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {
383 struct dma_fence *fence; 383 struct dma_fence *fence;
384 384
385 if (adev->mman.buffer_funcs_ring == NULL ||
386 !adev->mman.buffer_funcs_ring->ready) {
387 r = -EBUSY;
388 goto fail_free;
389 }
390
391 r = amdgpu_bo_reserve(bo, false); 385 r = amdgpu_bo_reserve(bo, false);
392 if (unlikely(r != 0)) 386 if (unlikely(r != 0))
393 goto fail_free; 387 goto fail_free;
@@ -397,7 +391,10 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
397 if (unlikely(r != 0)) 391 if (unlikely(r != 0))
398 goto fail_unreserve; 392 goto fail_unreserve;
399 393
400 amdgpu_fill_buffer(bo, 0, bo->tbo.resv, &fence); 394 r = amdgpu_fill_buffer(bo, 0, bo->tbo.resv, &fence);
395 if (unlikely(r))
396 goto fail_unreserve;
397
401 amdgpu_bo_fence(bo, fence, false); 398 amdgpu_bo_fence(bo, fence, false);
402 amdgpu_bo_unreserve(bo); 399 amdgpu_bo_unreserve(bo);
403 dma_fence_put(bo->tbo.moving); 400 dma_fence_put(bo->tbo.moving);