drm/amdgpu: Fix error handling in amdgpu_vm_init
authorFelix Kuehling <Felix.Kuehling@amd.com>
Sat, 26 Aug 2017 00:15:04 +0000 (20:15 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 17:07:01 +0000 (13:07 -0400)
Make sure vm->root.bo is not left reserved if amdgpu_bo_kmap fails.

Signed-off-by: Felix Kuehling <Felix.Kuehling@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_vm.c

index 2df254cc802e2e63d9eae472c718dcfffaf72d1b..2196bca7331c262fb6aade12513e1d5cfb7ca990 100644 (file)
@@ -2615,9 +2615,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                        goto error_free_root;
 
                r = amdgpu_bo_kmap(vm->root.base.bo, NULL);
+               amdgpu_bo_unreserve(vm->root.base.bo);
                if (r)
                        goto error_free_root;
-               amdgpu_bo_unreserve(vm->root.base.bo);
        }
 
        return 0;