From d0c6a090d534598aef0286cb844d442c1ef13d27 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Tue, 6 Mar 2018 21:19:30 +0900 Subject: [PATCH] android: ion: fix missing debug info of cma heap cma heaps shows the list of allocated buffers from their heap. But cma heaps do not show the list when cma fails to allocate, actually. Change-Id: I4b2264bd213d77d7c4276a45b560e6611b4c3b93 Signed-off-by: Cho KyongHo --- drivers/staging/android/ion/ion_cma_heap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c index 12a02455b99d..8e3d86d769b0 100644 --- a/drivers/staging/android/ion/ion_cma_heap.c +++ b/drivers/staging/android/ion/ion_cma_heap.c @@ -58,7 +58,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, if (!pages) { pr_err("%s: failed to allocate from %s(id %d), size %lu\n", __func__, cma_heap->heap.name, cma_heap->heap.id, len); - return -ENOMEM; + goto err; } if (!(flags & ION_FLAG_NOZEROED)) { @@ -81,7 +81,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, table = kmalloc(sizeof(*table), GFP_KERNEL); if (!table) - goto err; + goto err_table; ret = sg_alloc_table(table, 1, GFP_KERNEL); if (ret) { @@ -111,8 +111,9 @@ err_prot: sg_free_table(buffer->sg_table); free_mem: kfree(table); -err: +err_table: cma_release(cma_heap->cma, pages, nr_pages); +err: ion_contig_heap_show_buffers(&cma_heap->heap, cma_get_base(cma_heap->cma), cma_get_size(cma_heap->cma)); -- 2.20.1