drm/amdgpu: fix initializing the VM last eviction counter
authorChristian König <christian.koenig@amd.com>
Fri, 16 Sep 2016 11:11:45 +0000 (13:11 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 28 Sep 2016 20:16:22 +0000 (16:16 -0400)
Close a very small window where something can go wrong.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
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 9f4ff29df80de65acaa4a4cb84eccc7753429d09..04aa5a77e953ff037edfa948027d5743357e3bcc 100644 (file)
@@ -1629,13 +1629,17 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
                goto error_free_page_directory;
 
        r = amdgpu_vm_clear_bo(adev, vm, vm->page_directory);
-       amdgpu_bo_unreserve(vm->page_directory);
        if (r)
-               goto error_free_page_directory;
+               goto error_unreserve;
+
        vm->last_eviction_counter = atomic64_read(&adev->num_evictions);
+       amdgpu_bo_unreserve(vm->page_directory);
 
        return 0;
 
+error_unreserve:
+       amdgpu_bo_unreserve(vm->page_directory);
+
 error_free_page_directory:
        amdgpu_bo_unref(&vm->page_directory->shadow);
        amdgpu_bo_unref(&vm->page_directory);