ion: convert map_kernel to return ERR_PTR
authorColin Cross <ccross@android.com>
Fri, 13 Dec 2013 22:24:48 +0000 (14:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:57:17 +0000 (08:57 -0800)
ion is going to stop accepting NULL as an error value, use ERR_PTR.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_carveout_heap.c
drivers/staging/android/ion/ion_heap.c

index fd641688127c52376ac945326278dbcd06c18ed2..36df34c1ed53b519071c338667a84e468605137e 100644 (file)
@@ -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,
index cc2a42547605d797df2ba8d7469253708ae2b457..a584ec0368624881c4d6fb7b816f8cce8b2037f2 100644 (file)
@@ -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;
 }