lkml.org 
[lkml]   [2013]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 074/115] ion: convert map_kernel to return ERR_PTR
Date
From: Colin Cross <ccross@android.com>

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>
---
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


\
 
 \ /
  Last update: 2013-12-14 00:21    [W:0.539 / U:1.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site