Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jaewon Kim and committed by
Greg Kroah-Hartman
aacd1783 e7954918

+2 -4
+2 -4
drivers/staging/android/ion/ion_cma_heap.c
··· 24 24 #include "ion.h" 25 25 #include "ion_priv.h" 26 26 27 - #define ION_CMA_ALLOCATE_FAILED -1 28 - 29 27 struct ion_cma_heap { 30 28 struct ion_heap heap; 31 29 struct device *dev; ··· 57 59 58 60 info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL); 59 61 if (!info) 60 - return ION_CMA_ALLOCATE_FAILED; 62 + return -ENOMEM; 61 63 62 64 info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle), 63 65 GFP_HIGHUSER | __GFP_ZERO); ··· 86 88 dma_free_coherent(dev, len, info->cpu_addr, info->handle); 87 89 err: 88 90 kfree(info); 89 - return ION_CMA_ALLOCATE_FAILED; 91 + return -ENOMEM; 90 92 } 91 93 92 94 static void ion_cma_free(struct ion_buffer *buffer)