From: Jaewon Kim <jaewon31.kim@samsung.com>
To: gregkh@linuxfoundation.org
Cc: labbott@redhat.com, sumit.semwal@linaro.org, tixy@linaro.org,
prime.zeng@huawei.com, tranmanphong@gmail.com,
fabio.estevam@freescale.com, ccross@android.com,
rebecca@android.com, benjamin.gaignard@linaro.org,
arve@android.com, riandrews@android.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com,
Jaewon Kim <jaewon31.kim@samsung.com>
Subject: [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap allocation failure
Date: Fri, 09 Dec 2016 14:05:30 +0900 [thread overview]
Message-ID: <1481259930-4620-2-git-send-email-jaewon31.kim@samsung.com> (raw)
In-Reply-To: <1481259930-4620-1-git-send-email-jaewon31.kim@samsung.com>
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>
---
drivers/staging/android/ion/ion_cma_heap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index 6c7de74..22b9582 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -24,8 +24,6 @@
#include "ion.h"
#include "ion_priv.h"
-#define ION_CMA_ALLOCATE_FAILED -1
-
struct ion_cma_heap {
struct ion_heap heap;
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);
if (!info)
- return ION_CMA_ALLOCATE_FAILED;
+ return -ENOMEM;
info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
GFP_HIGHUSER | __GFP_ZERO);
@@ -88,7 +86,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
dma_free_coherent(dev, len, info->cpu_addr, info->handle);
err:
kfree(info);
- return ION_CMA_ALLOCATE_FAILED;
+ return -ENOMEM;
}
static void ion_cma_free(struct ion_buffer *buffer)
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-12-09 5:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-09 5:05 [PATCH] [RFC] drivers: dma-coherent: pass struct dma_attrs to dma_alloc_from_coherent Jaewon Kim
2016-12-09 5:05 ` Jaewon Kim [this message]
2016-12-13 16:04 ` [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap allocation failure Laura Abbott
2016-12-17 12:00 ` Jaewon Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481259930-4620-2-git-send-email-jaewon31.kim@samsung.com \
--to=jaewon31.kim@samsung.com \
--cc=arve@android.com \
--cc=benjamin.gaignard@linaro.org \
--cc=ccross@android.com \
--cc=fabio.estevam@freescale.com \
--cc=gregkh@linuxfoundation.org \
--cc=jaewon31.kim@gmail.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=prime.zeng@huawei.com \
--cc=rebecca@android.com \
--cc=riandrews@android.com \
--cc=sumit.semwal@linaro.org \
--cc=tixy@linaro.org \
--cc=tranmanphong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).