[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7ac949fbedccaa86c27db0dd045f10be97ec74b1.1490261637.git.geliangtang@gmail.com>
Date: Thu, 23 Mar 2017 21:12:39 +0800
From: Geliang Tang <geliangtang@...il.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Daeseok Youn <daeseok.youn@...il.com>,
Alan Cox <alan@...ux.intel.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
simran singhal <singhalsimran0@...il.com>
Cc: Geliang Tang <geliangtang@...il.com>, linux-media@...r.kernel.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: media: atomisp: use kvmalloc and kvfree
Use kvmalloc() and kvfree() instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@...il.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
Powered by blists - more mailing lists