From: Colin Cross <[email protected]>

ion is going to stop accepting NULL as an error value, use ERR_PTR.

Signed-off-by: Colin Cross <[email protected]>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <[email protected]>
---
 drivers/staging/android/ion/ion_carveout_heap.c | 7 ++++++-
 drivers/staging/android/ion/ion_heap.c          | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index fd64168..36df34c 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/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/staging/android/ion/ion_heap.c 
b/drivers/staging/android/ion/ion_heap.c
index cc2a425..a584ec0 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/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;
 }
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to