Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1607473 > unrolled thread

[PATCH] staging: media: atomisp: use kvmalloc and kvfree

Started byGeliang Tang <geliangtang@gmail.com>
First post2017-03-23 14:20 +0100
Last post2017-03-23 14:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [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

#1607473 — [PATCH] staging: media: atomisp: use kvmalloc and kvfree

FromGeliang Tang <geliangtang@gmail.com>
Date2017-03-23 14:20 +0100
Subject[PATCH] staging: media: atomisp: use kvmalloc and kvfree
Message-ID<toaOJ-2Hz-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1607497

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-23 14:40 +0100
Message-ID<tob85-2Oe-5@gated-at.bofh.it>
In reply to#1607473
On Thu, Mar 23, 2017 at 09:12:39PM +0800, Geliang Tang wrote:
> Use kvmalloc() and kvfree() instead of open-coding.

These functions are not in Linus's tree, so I can't apply this patch
without breaking things :(

thanks,

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web