Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1683490 > unrolled thread
| Started by | Amitoj Kaur Chawla <amitoj1606@gmail.com> |
|---|---|
| First post | 2017-07-08 02:50 +0200 |
| Last post | 2017-07-08 03:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 1/2] staging: media: atomisp2: css2400: Replace kfree()/vfree() with kvfree() Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2017-07-08 02:50 +0200
Re: [PATCH 1/2] staging: media: atomisp2: css2400: Replace kfree()/vfree() with kvfree() Joe Perches <joe@perches.com> - 2017-07-08 03:00 +0200
| From | Amitoj Kaur Chawla <amitoj1606@gmail.com> |
|---|---|
| Date | 2017-07-08 02:50 +0200 |
| Subject | [PATCH 1/2] staging: media: atomisp2: css2400: Replace kfree()/vfree() with kvfree() |
| Message-ID | <u0M6B-3qm-5@gated-at.bofh.it> |
Conditionally calling kfree()/vfree() can be replaced by a call to
kvfree() which handles both kmalloced memory and vmalloced memory.
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/css2400/sh_css.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
index 73c7658..1b0708f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -2029,10 +2029,7 @@ void *sh_css_calloc(size_t N, size_t size)
void sh_css_free(void *ptr)
{
- if (is_vmalloc_addr(ptr))
- vfree(ptr);
- else
- kfree(ptr);
+ kvfree(ptr);
}
/* For Acceleration API: Flush FW (shared buffer pointer) arguments */
--
2.7.4
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-07-08 03:00 +0200 |
| Message-ID | <u0Mgi-3ua-7@gated-at.bofh.it> |
| In reply to | #1683490 |
On Fri, 2017-07-07 at 20:40 -0400, Amitoj Kaur Chawla wrote:
> Conditionally calling kfree()/vfree() can be replaced by a call to
> kvfree() which handles both kmalloced memory and vmalloced memory.
[]
> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
[]
> @@ -2029,10 +2029,7 @@ void *sh_css_calloc(size_t N, size_t size)
>
> void sh_css_free(void *ptr)
> {
> - if (is_vmalloc_addr(ptr))
> - vfree(ptr);
> - else
> - kfree(ptr);
> + kvfree(ptr);
> }
Why not just get rid of sh_css_free and use kvfree directly?
Why not get rid of all the sh_css_<alloc/free> functions?
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web