From d37aa151f874563a35d49a0ff0a129ef332c5e9e Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 21 Aug 2013 12:50:37 -0700 Subject: [PATCH] ion: convert map_kernel to return ERR_PTR ion is going to stop accepting NULL as an error value, use ERR_PTR. Change-Id: I030e8b72138904e38a4a5d225beaaa98427651fb Signed-off-by: Colin Cross --- drivers/gpu/ion/ion_carveout_heap.c | 7 ++++++- drivers/gpu/ion/ion_heap.c | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/ion/ion_carveout_heap.c b/drivers/gpu/ion/ion_carveout_heap.c index ce8d311968f6..86f35545eaf7 100644 --- a/drivers/gpu/ion/ion_carveout_heap.c +++ b/drivers/gpu/ion/ion_carveout_heap.c @@ -112,13 +112,18 @@ void ion_carveout_heap_unmap_dma(struct ion_heap *heap, void *ion_carveout_heap_map_kernel(struct ion_heap *heap, struct ion_buffer *buffer) { + void *ret; int mtype = MT_MEMORY_NONCACHED; if (buffer->flags & ION_FLAG_CACHED) mtype = MT_MEMORY; - return __arm_ioremap(buffer->priv_phys, buffer->size, + ret = __arm_ioremap(buffer->priv_phys, buffer->size, mtype); + if (ret == NULL) + return ERR_PTR(-ENOMEM); + + return ret; } void ion_carveout_heap_unmap_kernel(struct ion_heap *heap, diff --git a/drivers/gpu/ion/ion_heap.c b/drivers/gpu/ion/ion_heap.c index bf6a383bd98b..786302de7ed0 100644 --- a/drivers/gpu/ion/ion_heap.c +++ b/drivers/gpu/ion/ion_heap.c @@ -56,6 +56,9 @@ void *ion_heap_map_kernel(struct ion_heap *heap, vaddr = vmap(pages, npages, VM_MAP, pgprot); vfree(pages); + if (vaddr == NULL) + return ERR_PTR(-ENOMEM); + return vaddr; } -- 2.34.1