gpu: nvgpu: Do not access alloc after freeing it

Move debug write so that we access length and base of allocation
before the alloc structure gets freed.

Change-Id: I02e418f423beaa2b52a32d1abcff327b68dd5fa6
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1249959
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
This commit is contained in:
Terje Bergstrom
2016-11-08 13:00:11 -08:00
committed by mobile promotions
parent 9d4f04a68e
commit 9c8a3df142

View File

@@ -629,6 +629,9 @@ static void gk20a_page_free(struct gk20a_allocator *__a, u64 base)
a->nr_frees++;
palloc_dbg(a, "Free 0x%llx id=0x%010llx\n",
alloc->length, alloc->base);
/*
* Frees *alloc.
*/
@@ -639,9 +642,6 @@ static void gk20a_page_free(struct gk20a_allocator *__a, u64 base)
__gk20a_free_pages(a, alloc, true);
}
palloc_dbg(a, "Free 0x%llx id=0x%010llx\n",
alloc->length, alloc->base);
done:
alloc_unlock(__a);
}
@@ -740,10 +740,10 @@ static void gk20a_page_free_fixed(struct gk20a_allocator *__a,
* allocs. This would have to be updated if the underlying
* allocator were to change.
*/
__gk20a_free_pages(a, alloc, true);
palloc_dbg(a, "Free [fixed] 0x%010llx + 0x%llx\n",
alloc->base, alloc->length);
__gk20a_free_pages(a, alloc, true);
a->nr_fixed_frees++;
a->pages_freed += (alloc->length >> a->page_shift);