提交 05f1d92f 编写于 作者: A Amitoj Kaur Chawla 提交者: Mauro Carvalho Chehab

media: staging: atomisp: Use kvfree() instead of kfree()/vfree()

Conditionally calling kfree()/vfree() can be replaced by a call to
kvfree() which handles both kmalloced memory and vmalloced memory.
The resulting wrapper function has been replaced with direct calls
to kvfree().

This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
expression a;
@@
- if(...) { vfree(a); }
- else { kfree(a); }
+ kvfree(a);
// </smpl>
Signed-off-by: NAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 e1990222
......@@ -111,19 +111,6 @@ void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem)
return ptr;
}
/*
* Free buffer allocated with atomisp_kernel_malloc()/atomisp_kernel_zalloc
* helper
*/
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);
}
/*
* get sensor:dis71430/ov2720 related info from v4l2_subdev->priv data field.
* subdev->priv is set in mrst.c
......@@ -785,7 +772,7 @@ void atomisp_flush_params_queue(struct atomisp_video_pipe *pipe)
struct atomisp_css_params_with_list, list);
list_del(&param->list);
atomisp_free_css_parameters(&param->params);
atomisp_kernel_free(param);
kvfree(param);
}
}
......@@ -1132,7 +1119,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
asd->params.dvs_6axis = NULL;
atomisp_free_css_parameters(
&pipe->frame_params[vb->i]->params);
atomisp_kernel_free(pipe->frame_params[vb->i]);
kvfree(pipe->frame_params[vb->i]);
pipe->frame_params[vb->i] = NULL;
}
......@@ -4375,7 +4362,7 @@ int atomisp_set_parameters(struct video_device *vdev,
if (css_param)
atomisp_free_css_parameters(css_param);
if (param)
atomisp_kernel_free(param);
kvfree(param);
return ret;
}
......
......@@ -80,7 +80,6 @@ static inline void __iomem *atomisp_get_io_virt_addr(unsigned int address)
*/
void *atomisp_kernel_malloc(size_t bytes);
void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem);
void atomisp_kernel_free(void *ptr);
/*
* Interrupt functions
......
......@@ -1676,7 +1676,7 @@ int atomisp_alloc_metadata_output_buf(struct atomisp_sub_device *asd)
stream_info.metadata_info.size);
if (!asd->params.metadata_user[i]) {
while (--i >= 0) {
atomisp_kernel_free(asd->params.metadata_user[i]);
kvfree(asd->params.metadata_user[i]);
asd->params.metadata_user[i] = NULL;
}
return -ENOMEM;
......@@ -1692,7 +1692,7 @@ void atomisp_free_metadata_output_buf(struct atomisp_sub_device *asd)
for (i = 0; i < ATOMISP_METADATA_TYPE_NUM; i++) {
if (asd->params.metadata_user[i]) {
atomisp_kernel_free(asd->params.metadata_user[i]);
kvfree(asd->params.metadata_user[i]);
asd->params.metadata_user[i] = NULL;
}
}
......
......@@ -312,8 +312,6 @@ extern struct device *atomisp_dev;
extern void *atomisp_kernel_malloc(size_t bytes);
extern void atomisp_kernel_free(void *ptr);
#define atomisp_is_wdt_running(a) timer_pending(&(a)->wdt)
#ifdef ISP2401
extern void atomisp_wdt_refresh_pipe(struct atomisp_video_pipe *pipe,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册