diff options
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index cc6dca2581a6..dcb2d3859cf1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -90,10 +90,13 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev, | |||
90 | struct amdgpu_bo_list_entry *list; | 90 | struct amdgpu_bo_list_entry *list; |
91 | unsigned i, idx; | 91 | unsigned i, idx; |
92 | 92 | ||
93 | mutex_lock(&vm->mutex); | ||
93 | list = drm_malloc_ab(vm->max_pde_used + 2, | 94 | list = drm_malloc_ab(vm->max_pde_used + 2, |
94 | sizeof(struct amdgpu_bo_list_entry)); | 95 | sizeof(struct amdgpu_bo_list_entry)); |
95 | if (!list) | 96 | if (!list) { |
97 | mutex_unlock(&vm->mutex); | ||
96 | return NULL; | 98 | return NULL; |
99 | } | ||
97 | 100 | ||
98 | /* add the vm page table to the list */ | 101 | /* add the vm page table to the list */ |
99 | list[0].robj = vm->page_directory; | 102 | list[0].robj = vm->page_directory; |
@@ -116,6 +119,7 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev, | |||
116 | list[idx].tv.shared = true; | 119 | list[idx].tv.shared = true; |
117 | list_add(&list[idx++].tv.head, head); | 120 | list_add(&list[idx++].tv.head, head); |
118 | } | 121 | } |
122 | mutex_unlock(&vm->mutex); | ||
119 | 123 | ||
120 | return list; | 124 | return list; |
121 | } | 125 | } |