diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-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 9de589f9..af7e0b51 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, | |||
1103 | int rw_flag) | 1103 | int rw_flag) |
1104 | { | 1104 | { |
1105 | int err = 0, i = 0; | 1105 | int err = 0, i = 0; |
1106 | bool allocated = false; | ||
1106 | u32 pde_lo, pde_hi; | 1107 | u32 pde_lo, pde_hi; |
1107 | struct device *d = dev_from_vm(vm); | 1108 | struct device *d = dev_from_vm(vm); |
1108 | 1109 | ||
@@ -1113,8 +1114,9 @@ static u64 __locked_gmmu_map(struct vm_gk20a *vm, | |||
1113 | if (!map_offset) { | 1114 | if (!map_offset) { |
1114 | gk20a_err(d, "failed to allocate va space"); | 1115 | gk20a_err(d, "failed to allocate va space"); |
1115 | err = -ENOMEM; | 1116 | err = -ENOMEM; |
1116 | goto fail; | 1117 | goto fail_alloc; |
1117 | } | 1118 | } |
1119 | allocated = true; | ||
1118 | } | 1120 | } |
1119 | 1121 | ||
1120 | pde_range_from_vaddr_range(vm, | 1122 | pde_range_from_vaddr_range(vm, |
@@ -1129,7 +1131,7 @@ static u64 __locked_gmmu_map(struct vm_gk20a *vm, | |||
1129 | if (err) { | 1131 | if (err) { |
1130 | gk20a_err(d, "failed to validate page table %d: %d", | 1132 | gk20a_err(d, "failed to validate page table %d: %d", |
1131 | i, err); | 1133 | i, err); |
1132 | goto fail; | 1134 | goto fail_validate; |
1133 | } | 1135 | } |
1134 | } | 1136 | } |
1135 | 1137 | ||
@@ -1143,11 +1145,14 @@ static u64 __locked_gmmu_map(struct vm_gk20a *vm, | |||
1143 | rw_flag); | 1145 | rw_flag); |
1144 | if (err) { | 1146 | if (err) { |
1145 | gk20a_err(d, "failed to update ptes on map"); | 1147 | gk20a_err(d, "failed to update ptes on map"); |
1146 | goto fail; | 1148 | goto fail_validate; |
1147 | } | 1149 | } |
1148 | 1150 | ||
1149 | return map_offset; | 1151 | return map_offset; |
1150 | fail: | 1152 | fail_validate: |
1153 | if (allocated) | ||
1154 | gk20a_vm_free_va(vm, map_offset, size, pgsz_idx); | ||
1155 | fail_alloc: | ||
1151 | gk20a_err(d, "%s: failed with err=%d\n", __func__, err); | 1156 | gk20a_err(d, "%s: failed with err=%d\n", __func__, err); |
1152 | return 0; | 1157 | return 0; |
1153 | } | 1158 | } |