From 87226707cfbabbf38a1a954dedd3575e67bbe48d Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Wed, 25 Mar 2015 12:47:12 -0700 Subject: gpu: nvgpu: Fix error paths in init vm Error paths called the wrong cleanup sections. Change-Id: I603af77bf8e3981c029bcf6d582882e51847f137 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/722949 --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 3d2e5450..0ddd9ecb 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -2273,10 +2273,8 @@ int gk20a_init_vm(struct mm_gk20a *mm, vm->pdb.entries = kzalloc(sizeof(struct gk20a_mm_entry) * (pde_hi + 1), GFP_KERNEL); - if (!vm->pdb.entries) { - err = -ENOMEM; - goto clean_up_pdes; - } + if (!vm->pdb.entries) + return -ENOMEM; gk20a_dbg_info("init space for %s va_limit=0x%llx num_pdes=%d", name, vm->va_limit, pde_hi + 1); @@ -2284,7 +2282,7 @@ int gk20a_init_vm(struct mm_gk20a *mm, /* allocate the page table directory */ err = gk20a_zalloc_gmmu_page_table(vm, 0, &vm->mmu_levels[0], &vm->pdb); if (err) - goto clean_up_ptes; + goto clean_up_pdes; /* First 16GB of the address space goes towards small pages. What ever * remains is allocated to large pages. */ @@ -2308,7 +2306,7 @@ int gk20a_init_vm(struct mm_gk20a *mm, low_hole_pages, /*start*/ num_small_pages - low_hole_pages);/* length*/ if (err) - goto clean_up_map_pde; + goto clean_up_ptes; if (big_pages) { u32 start = (u32)(small_vma_size >> @@ -2336,8 +2334,6 @@ int gk20a_init_vm(struct mm_gk20a *mm, clean_up_small_allocator: gk20a_allocator_destroy(&vm->vma[gmmu_page_size_small]); -clean_up_map_pde: - unmap_gmmu_pages(&vm->pdb); clean_up_ptes: free_gmmu_pages(vm, &vm->pdb); clean_up_pdes: -- cgit v1.2.2