diff options
author | Shridhar Rasal <srasal@nvidia.com> | 2014-04-22 21:15:25 +0530 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2014-05-27 18:46:03 -0700 |
commit | 7f7b24b1c88b6a3d67a39b8b4e18b4bba0bead59 (patch) | |
tree | ff6092f4a801dd3d4c46b007b3f49e3a8fd6ddbf /drivers/gpu | |
parent | eae2abec05893045e96a46f9f815dbc11a8710b6 (diff) |
gpu: nvgpu: mm: free allocations on validate error
Free allocated virtual address when marking PTE for validation
or update fails.
Bug 1479803
Change-Id: I9a8bd7c245b478f4252a261f246002fcc65d750d
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
(cherry picked from commit b5c0ad4e00dfc86b65e8efe3d8691b5cfaafbe4c)
Reviewed-on: http://git-master/r/415248
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 9de589f9d6e2..af7e0b512f5e 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -1103,6 +1103,7 @@ static u64 __locked_gmmu_map(struct vm_gk20a *vm, int rw_flag) { int err = 0, i = 0; + bool allocated = false; u32 pde_lo, pde_hi; struct device *d = dev_from_vm(vm); @@ -1113,8 +1114,9 @@ static u64 __locked_gmmu_map(struct vm_gk20a *vm, if (!map_offset) { gk20a_err(d, "failed to allocate va space"); err = -ENOMEM; - goto fail; + goto fail_alloc; } + allocated = true; } pde_range_from_vaddr_range(vm, @@ -1129,7 +1131,7 @@ static u64 __locked_gmmu_map(struct vm_gk20a *vm, if (err) { gk20a_err(d, "failed to validate page table %d: %d", i, err); - goto fail; + goto fail_validate; } } @@ -1143,11 +1145,14 @@ static u64 __locked_gmmu_map(struct vm_gk20a *vm, rw_flag); if (err) { gk20a_err(d, "failed to update ptes on map"); - goto fail; + goto fail_validate; } return map_offset; - fail: +fail_validate: + if (allocated) + gk20a_vm_free_va(vm, map_offset, size, pgsz_idx); +fail_alloc: gk20a_err(d, "%s: failed with err=%d\n", __func__, err); return 0; } |