From: "Wang, Yalin" <Yalin.Wang@sonymobile.com>
To: "'gregkh@linuxfoundation.org'" <gregkh@linuxfoundation.org>,
"'tranmanphong@gmail.com'" <tranmanphong@gmail.com>,
"'fabio.estevam@freescale.com'" <fabio.estevam@freescale.com>,
"'prime.zeng@huawei.com'" <prime.zeng@huawei.com>,
"'devel@driverdev.osuosl.org'" <devel@driverdev.osuosl.org>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Cc: "Gao, Neil" <Neil.Gao@sonymobile.com>
Subject: [RFC] ion:change ion_cma_allocate return error value
Date: Tue, 27 Jan 2015 14:04:21 +0800 [thread overview]
Message-ID: <35FD53F367049845BC99AC72306C23D1044A02027DF9@CNBJMBX05.corpusers.net> (raw)
This patch change the error return value from -1 to -ENOMEM,
so that userspace can get the correct errno, otherwise,
-1 will be -EPERM, userspace will print permission deny for allocation
failure.
Signed-off-by: Yalin Wang <yalin.wang@sonymobile.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 f4211f1..55bcaec2 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);
@@ -87,7 +85,7 @@ free_mem:
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)
--
2.2.2
next reply other threads:[~2015-01-27 6:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-27 6:04 Wang, Yalin [this message]
2015-01-27 7:26 ` Dan Carpenter
2015-01-28 18:45 ` 'gregkh@linuxfoundation.org'
2015-01-29 1:41 ` Wang, Yalin
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=35FD53F367049845BC99AC72306C23D1044A02027DF9@CNBJMBX05.corpusers.net \
--to=yalin.wang@sonymobile.com \
--cc=Neil.Gao@sonymobile.com \
--cc=devel@driverdev.osuosl.org \
--cc=fabio.estevam@freescale.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prime.zeng@huawei.com \
--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
Powered by JetHome