Browse Source

staging: android: ion: return -ENOMEM in ion_cma_heap allocation failure

Initial Commit 349c9e138551 ("gpu: ion: add CMA heap") returns -1 in allocation
failure. The returned value is passed up to userspace through ioctl. So user can
misunderstand error reason as -EPERM(1) rather than -ENOMEM(12).

This patch simply changed this to return -ENOMEM.

Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jaewon Kim 8 years ago
parent
commit
aacd178373
1 changed files with 2 additions and 4 deletions
  1. 2 4
      drivers/staging/android/ion/ion_cma_heap.c

+ 2 - 4
drivers/staging/android/ion/ion_cma_heap.c

@@ -24,8 +24,6 @@
 #include "ion.h"
 #include "ion.h"
 #include "ion_priv.h"
 #include "ion_priv.h"
 
 
-#define ION_CMA_ALLOCATE_FAILED -1
-
 struct ion_cma_heap {
 struct ion_cma_heap {
 	struct ion_heap heap;
 	struct ion_heap heap;
 	struct device *dev;
 	struct device *dev;
@@ -59,7 +57,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 
 
 	info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
 	info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
 	if (!info)
 	if (!info)
-		return ION_CMA_ALLOCATE_FAILED;
+		return -ENOMEM;
 
 
 	info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
 	info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
 						GFP_HIGHUSER | __GFP_ZERO);
 						GFP_HIGHUSER | __GFP_ZERO);
@@ -88,7 +86,7 @@ free_mem:
 	dma_free_coherent(dev, len, info->cpu_addr, info->handle);
 	dma_free_coherent(dev, len, info->cpu_addr, info->handle);
 err:
 err:
 	kfree(info);
 	kfree(info);
-	return ION_CMA_ALLOCATE_FAILED;
+	return -ENOMEM;
 }
 }
 
 
 static void ion_cma_free(struct ion_buffer *buffer)
 static void ion_cma_free(struct ion_buffer *buffer)