[PATCH 1/9] drm/amdgpu: Fix error handling in amdgpu_vm_init

Felix Kuehling Felix.Kuehling at amd.com
Sat Aug 26 07:19:01 UTC 2017


Make sure vm->root.bo is not left reserved if amdgpu_bo_kmap fails.

Change-Id: If3687b39a50b0ffe7f8be2ea6e927fa2ca0f9e45
Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e57a72e..70d7632 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2556,14 +2556,11 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 		goto error_free_root;
 
 	vm->last_eviction_counter = atomic64_read(&adev->num_evictions);
-
-	if (vm->use_cpu_for_update) {
+	if (vm->use_cpu_for_update)
 		r = amdgpu_bo_kmap(vm->root.bo, NULL);
-		if (r)
-			goto error_free_root;
-	}
-
 	amdgpu_bo_unreserve(vm->root.bo);
+	if (r)
+		goto error_free_root;
 
 	vm->vm_context = vm_context;
 	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE) {
-- 
2.7.4



More information about the amd-gfx mailing list