From: Amitoj Kaur Chawla <amitoj1606@gmail.com>
To: mchehab@kernel.org, gregkh@linuxfoundation.org,
linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] staging: media: atomisp2: Replace kfree()/vfree() with kvfree()
Date: Fri, 7 Jul 2017 20:41:02 -0400 [thread overview]
Message-ID: <20170708004102.GA27161@amitoj-Inspiron-3542> (raw)
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
next reply other threads:[~2017-07-08 0:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-08 0:41 Amitoj Kaur Chawla [this message]
2017-07-08 8:58 ` [PATCH 2/2] staging: media: atomisp2: Replace kfree()/vfree() with kvfree() Bernd Petrovitsch
2017-07-08 22:55 ` Amitoj Kaur Chawla
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=20170708004102.GA27161@amitoj-Inspiron-3542 \
--to=amitoj1606@gmail.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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.