Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1607473
| From | Geliang Tang <geliangtang@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] staging: media: atomisp: use kvmalloc and kvfree |
| Date | 2017-03-23 14:20 +0100 |
| Message-ID | <toaOJ-2Hz-11@gated-at.bofh.it> (permalink) |
| References | <toaOJ-2Hz-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] staging: media: atomisp: use kvmalloc and kvfree Geliang Tang <geliangtang@gmail.com> - 2017-03-23 14:20 +0100 Re: [PATCH] staging: media: atomisp: use kvmalloc and kvfree Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-23 14:40 +0100
csiph-web