diff options
author | seshendra Gadagottu <sgadagottu@nvidia.com> | 2017-08-18 18:27:20 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-22 14:15:50 -0400 |
commit | 5df1d3ff7a23ec39ea5fc841b2dbfe98fa74b44a (patch) | |
tree | 8a34b38d4e560b025270089d33993aaa0a6e2908 /drivers | |
parent | ddeadd8cf250efa190ebc349776e90420a302038 (diff) |
gpu: nvgpu: gv11b: release eng_method_buffers
In case of any error while allocating eng_method_buffers
release allocated buffers gracefully.
Change-Id: Ic9d86b63d2405fd0113e63f2fc3f96166a4de9b5
Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1541510
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c index 48d14e74..80bb64a0 100644 --- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | |||
@@ -1543,7 +1543,8 @@ void gv11b_fifo_init_eng_method_buffers(struct gk20a *g, | |||
1543 | { | 1543 | { |
1544 | struct vm_gk20a *vm = g->mm.bar2.vm; | 1544 | struct vm_gk20a *vm = g->mm.bar2.vm; |
1545 | int err = 0; | 1545 | int err = 0; |
1546 | unsigned int i, runque, method_buffer_size; | 1546 | int i; |
1547 | unsigned int runque, method_buffer_size; | ||
1547 | unsigned int num_pbdma = g->fifo.num_pbdma; | 1548 | unsigned int num_pbdma = g->fifo.num_pbdma; |
1548 | 1549 | ||
1549 | if (tsg->eng_method_buffers != NULL) | 1550 | if (tsg->eng_method_buffers != NULL) |
@@ -1565,9 +1566,9 @@ void gv11b_fifo_init_eng_method_buffers(struct gk20a *g, | |||
1565 | break; | 1566 | break; |
1566 | } | 1567 | } |
1567 | if (err) { | 1568 | if (err) { |
1568 | for (i = runque; i < runque; i--) | 1569 | for (i = (runque - 1); i >= 0; i--) |
1569 | nvgpu_dma_unmap_free(vm, | 1570 | nvgpu_dma_unmap_free(vm, |
1570 | &tsg->eng_method_buffers[runque]); | 1571 | &tsg->eng_method_buffers[i]); |
1571 | 1572 | ||
1572 | nvgpu_kfree(g, tsg->eng_method_buffers); | 1573 | nvgpu_kfree(g, tsg->eng_method_buffers); |
1573 | tsg->eng_method_buffers = NULL; | 1574 | tsg->eng_method_buffers = NULL; |