From: Geliang Tang <geliangtang@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Daeseok Youn <daeseok.youn@gmail.com>,
Alan Cox <alan@linux.intel.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
simran singhal <singhalsimran0@gmail.com>
Cc: Geliang Tang <geliangtang@gmail.com>,
linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] staging: media: atomisp: use kvmalloc and kvfree
Date: Thu, 23 Mar 2017 21:12:39 +0800 [thread overview]
Message-ID: <7ac949fbedccaa86c27db0dd045f10be97ec74b1.1490261637.git.geliangtang@gmail.com> (raw)
In-Reply-To: <328d0eb3da461aaaa6140b1409ee7550bcec87bb.1490261279.git.geliangtang@gmail.com>
Use kvmalloc() and kvfree() instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 94bc793..c7b9320 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -90,10 +90,7 @@ union host {
void *atomisp_kernel_malloc(size_t bytes)
{
/* vmalloc() is preferable if allocating more than 1 page */
- if (bytes > PAGE_SIZE)
- return vmalloc(bytes);
-
- return kmalloc(bytes, GFP_KERNEL);
+ return kvmalloc(bytes, GFP_KERNEL);
}
/*
@@ -118,10 +115,7 @@ void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem)
void atomisp_kernel_free(void *ptr)
{
/* Verify if buffer was allocated by vmalloc() or kmalloc() */
- if (is_vmalloc_addr(ptr))
- vfree(ptr);
- else
- kfree(ptr);
+ kvfree(ptr);
}
/*
--
2.9.3
next prev parent reply other threads:[~2017-03-23 13:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 13:12 [PATCH] staging: media: atomisp: fix build error Geliang Tang
2017-03-23 13:12 ` Geliang Tang [this message]
2017-03-23 13:37 ` [PATCH] staging: media: atomisp: use kvmalloc and kvfree Greg Kroah-Hartman
2017-03-23 15:59 ` [PATCH] staging: media: atomisp: fix build error Alan Cox
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=7ac949fbedccaa86c27db0dd045f10be97ec74b1.1490261637.git.geliangtang@gmail.com \
--to=geliangtang@gmail.com \
--cc=alan@linux.intel.com \
--cc=daeseok.youn@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=singhalsimran0@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).