android: ion: fix missing debug info of cma heap
authorCho KyongHo <pullip.cho@samsung.com>
Tue, 6 Mar 2018 12:19:30 +0000 (21:19 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:24 +0000 (19:45 +0900)
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 <pullip.cho@samsung.com>
drivers/staging/android/ion/ion_cma_heap.c

index 12a02455b99d0cd8f34cdd88f15ab1d2dc2b469a..8e3d86d769b0af8e4feaa6ab70a787b545f00218 100644 (file)
@@ -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));