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>
This commit is contained in:
seshendra Gadagottu
2017-08-18 15:27:20 -07:00
committed by mobile promotions
parent ddeadd8cf2
commit 5df1d3ff7a

View File

@@ -1543,7 +1543,8 @@ void gv11b_fifo_init_eng_method_buffers(struct gk20a *g,
{
struct vm_gk20a *vm = g->mm.bar2.vm;
int err = 0;
unsigned int i, runque, method_buffer_size;
int i;
unsigned int runque, method_buffer_size;
unsigned int num_pbdma = g->fifo.num_pbdma;
if (tsg->eng_method_buffers != NULL)
@@ -1565,9 +1566,9 @@ void gv11b_fifo_init_eng_method_buffers(struct gk20a *g,
break;
}
if (err) {
for (i = runque; i < runque; i--)
for (i = (runque - 1); i >= 0; i--)
nvgpu_dma_unmap_free(vm,
&tsg->eng_method_buffers[runque]);
&tsg->eng_method_buffers[i]);
nvgpu_kfree(g, tsg->eng_method_buffers);
tsg->eng_method_buffers = NULL;