mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] staging: media: atomisp2: Replace kfree()/vfree() with kvfree()
@ 2017-07-08  0:41 Amitoj Kaur Chawla
  2017-07-08  8:58 ` Bernd Petrovitsch
  0 siblings, 1 reply; 3+ messages in thread
From: Amitoj Kaur Chawla @ 2017-07-08  0:41 UTC (permalink / raw)
  To: mchehab, gregkh, linux-media, devel, linux-kernel

Conditionally calling kfree()/vfree() can be replaced by a call to 
kvfree() which handles both kmalloced memory and vmalloced memory. 
Consequently removed an unnecessary comment.

The Coccinelle semantic patch used to make the change is as follows:
//<smpl>
@@
expression a;
@@
- if(...) { vfree(a); }	
- else { kfree(a); }
+ kvfree(a);
@@
expression a;
@@
- if(...) { kfree(a); }	
- else { vfree(a); }
+ kvfree(a);
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 97093ba..a156dd424 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -117,11 +117,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.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-08 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-08  0:41 [PATCH 2/2] staging: media: atomisp2: Replace kfree()/vfree() with kvfree() Amitoj Kaur Chawla
2017-07-08  8:58 ` Bernd Petrovitsch
2017-07-08 22:55   ` Amitoj Kaur Chawla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®