ion: convert map_kernel to return ERR_PTR
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>
This commit is contained in:
parent
2540c73a5b
commit
dfc4a9b176
|
@ -112,13 +112,18 @@ void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
|
||||||
void *ion_carveout_heap_map_kernel(struct ion_heap *heap,
|
void *ion_carveout_heap_map_kernel(struct ion_heap *heap,
|
||||||
struct ion_buffer *buffer)
|
struct ion_buffer *buffer)
|
||||||
{
|
{
|
||||||
|
void *ret;
|
||||||
int mtype = MT_MEMORY_NONCACHED;
|
int mtype = MT_MEMORY_NONCACHED;
|
||||||
|
|
||||||
if (buffer->flags & ION_FLAG_CACHED)
|
if (buffer->flags & ION_FLAG_CACHED)
|
||||||
mtype = MT_MEMORY;
|
mtype = MT_MEMORY;
|
||||||
|
|
||||||
return __arm_ioremap(buffer->priv_phys, buffer->size,
|
ret = __arm_ioremap(buffer->priv_phys, buffer->size,
|
||||||
mtype);
|
mtype);
|
||||||
|
if (ret == NULL)
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ion_carveout_heap_unmap_kernel(struct ion_heap *heap,
|
void ion_carveout_heap_unmap_kernel(struct ion_heap *heap,
|
||||||
|
|
|
@ -56,6 +56,9 @@ void *ion_heap_map_kernel(struct ion_heap *heap,
|
||||||
vaddr = vmap(pages, npages, VM_MAP, pgprot);
|
vaddr = vmap(pages, npages, VM_MAP, pgprot);
|
||||||
vfree(pages);
|
vfree(pages);
|
||||||
|
|
||||||
|
if (vaddr == NULL)
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
return vaddr;
|
return vaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue