Skip to contentSkip to conversation

staging: android: ion: Return an ERR_PTR in ion_map_kernel

PATCH New Laura Abbott 1 participant 1 message Jun 11, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: android: ion: Return an ERR_PTR in ion_map_kernel

The expected return value from ion_map_kernel is an ERR_PTR. The error path for a vmalloc failure currently just returns NULL, triggering a warning in ion_buffer_kmap_get. Encode the vmalloc failure as an ERR_PTR.

---
 drivers/staging/android/ion/ion_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion_heap.c +1 -1
index 772dad65396e..f32c12439eee 100644
@@ -29,7 +29,7 @@ void *ion_heap_map_kernel(struct ion_heap *heap,
 	struct page **tmp = pages;
 
 	if (!pages)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	if (buffer->flags & ION_FLAG_CACHED)
 		pgprot = PAGE_KERNEL;
Signature · 1 line
2.17.0