diff options
author | Christian König <christian.koenig@amd.com> | 2016-09-16 07:06:09 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-28 16:16:21 -0400 |
commit | 2698f6206f53bc23a40a1412b304225a6d62d120 (patch) | |
tree | 2328c91d3c76e1761bc52a3c855bfb3de4d81206 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 0fc8683e568f228c08321fd99756f6230c98651b (diff) |
drm/amdgpu: cleanup VM shadow BO unreferencing
Unreference the shadow BOs in the error path as well and drop the NULL checks.
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 4ff285aae9f5..9f4ff29df80d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1430,6 +1430,7 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, | |||
1430 | 1430 | ||
1431 | r = amdgpu_vm_clear_bo(adev, vm, pt); | 1431 | r = amdgpu_vm_clear_bo(adev, vm, pt); |
1432 | if (r) { | 1432 | if (r) { |
1433 | amdgpu_bo_unref(&pt->shadow); | ||
1433 | amdgpu_bo_unref(&pt); | 1434 | amdgpu_bo_unref(&pt); |
1434 | goto error_free; | 1435 | goto error_free; |
1435 | } | 1436 | } |
@@ -1636,6 +1637,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
1636 | return 0; | 1637 | return 0; |
1637 | 1638 | ||
1638 | error_free_page_directory: | 1639 | error_free_page_directory: |
1640 | amdgpu_bo_unref(&vm->page_directory->shadow); | ||
1639 | amdgpu_bo_unref(&vm->page_directory); | 1641 | amdgpu_bo_unref(&vm->page_directory); |
1640 | vm->page_directory = NULL; | 1642 | vm->page_directory = NULL; |
1641 | 1643 | ||
@@ -1675,15 +1677,17 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
1675 | } | 1677 | } |
1676 | 1678 | ||
1677 | for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) { | 1679 | for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) { |
1678 | if (vm->page_tables[i].entry.robj && | 1680 | struct amdgpu_bo *pt = vm->page_tables[i].entry.robj; |
1679 | vm->page_tables[i].entry.robj->shadow) | 1681 | |
1680 | amdgpu_bo_unref(&vm->page_tables[i].entry.robj->shadow); | 1682 | if (!pt) |
1681 | amdgpu_bo_unref(&vm->page_tables[i].entry.robj); | 1683 | continue; |
1684 | |||
1685 | amdgpu_bo_unref(&pt->shadow); | ||
1686 | amdgpu_bo_unref(&pt); | ||
1682 | } | 1687 | } |
1683 | drm_free_large(vm->page_tables); | 1688 | drm_free_large(vm->page_tables); |
1684 | 1689 | ||
1685 | if (vm->page_directory->shadow) | 1690 | amdgpu_bo_unref(&vm->page_directory->shadow); |
1686 | amdgpu_bo_unref(&vm->page_directory->shadow); | ||
1687 | amdgpu_bo_unref(&vm->page_directory); | 1691 | amdgpu_bo_unref(&vm->page_directory); |
1688 | fence_put(vm->page_directory_fence); | 1692 | fence_put(vm->page_directory_fence); |
1689 | } | 1693 | } |