Commit a00b7ea3 authored by Christian König's avatar Christian König Committed by Greg Kroah-Hartman

drm/amdgpu: fix error handling in amdgpu_bo_do_create

commit a695e437 upstream.

The bo structure is freed up in case of an error, so we can't do any
accounting if that happens.
Signed-off-by: default avatarChristian König <>
Reviewed-by: default avatarMichel Dänzer <>
Signed-off-by: default avatarAlex Deucher <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 402b1de7
......@@ -391,6 +391,9 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
&bo->placement, page_align, !kernel, NULL,
acc_size, sg, resv, &amdgpu_ttm_bo_destroy);
if (unlikely(r != 0))
return r;
bytes_moved = atomic64_read(&adev->num_bytes_moved) -
if (adev->mc.visible_vram_size < adev->mc.real_vram_size &&
......@@ -400,9 +403,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
amdgpu_cs_report_moved_bytes(adev, bytes_moved, 0);
if (unlikely(r != 0))
return r;
if (kernel)
bo->tbo.priority = 1;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment