From 5df1d3ff7a23ec39ea5fc841b2dbfe98fa74b44a Mon Sep 17 00:00:00 2001 From: seshendra Gadagottu Date: Fri, 18 Aug 2017 15:27:20 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1541510 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gv11b/fifo_gv11b.c') 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, { 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; -- cgit v1.2.2