Commit 9955d906 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: atomisp: remove kvmalloc/kvcalloc abstractions



The sh_css layer adds an abstraction for kvmalloc/kvcalloc.

Get rid of them. Most of the work here was done by this
small coccinelle script:

<cocci>
@@
expression size;
@@

- sh_css_malloc(size)
+ kvmalloc(size, GFP_KERNEL)

@@
expression n;
expression size;
@@

- sh_css_calloc(n, size)
+ kvcalloc(n, size, GFP_KERNEL)
</cocci>

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 591e6a0a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ enum ia_css_err ia_css_refcount_init(uint32_t size)
		return IA_CSS_ERR_INTERNAL_ERROR;
	}
	myrefcount.items =
	    sh_css_malloc(sizeof(struct ia_css_refcount_entry) * size);
	    kvmalloc(sizeof(struct ia_css_refcount_entry) * size, GFP_KERNEL);
	if (!myrefcount.items)
		err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
	if (err == IA_CSS_SUCCESS) {
@@ -115,7 +115,7 @@ void ia_css_refcount_uninit(void)
			entry->id = 0;
		}
	}
	sh_css_free(myrefcount.items);
	kvfree(myrefcount.items);
	myrefcount.items = NULL;
	myrefcount.size = 0;
	ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
+7 −7
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ ia_css_isp_dvs_statistics_allocate(
	if (!grid->enable)
		return NULL;

	me = sh_css_calloc(1, sizeof(*me));
	me = kvcalloc(1, sizeof(*me), GFP_KERNEL);
	if (!me)
		goto err;

@@ -359,7 +359,7 @@ ia_css_isp_dvs_statistics_map_allocate(
	 * so we use a local char * instead. */
	char *base_ptr;

	me = sh_css_malloc(sizeof(*me));
	me = kvmalloc(sizeof(*me), GFP_KERNEL);
	if (!me) {
		IA_CSS_LOG("cannot allocate memory");
		goto err;
@@ -369,7 +369,7 @@ ia_css_isp_dvs_statistics_map_allocate(
	me->data_allocated = !data_ptr;

	if (!me->data_ptr) {
		me->data_ptr = sh_css_malloc(isp_stats->size);
		me->data_ptr = kvmalloc(isp_stats->size, GFP_KERNEL);
		if (!me->data_ptr) {
			IA_CSS_LOG("cannot allocate memory");
			goto err;
@@ -386,7 +386,7 @@ ia_css_isp_dvs_statistics_map_allocate(
	return me;
err:
	if (me)
		sh_css_free(me);
		kvfree(me);
	return NULL;
}

@@ -395,8 +395,8 @@ ia_css_isp_dvs_statistics_map_free(struct ia_css_isp_dvs_statistics_map *me)
{
	if (me) {
		if (me->data_allocated)
			sh_css_free(me->data_ptr);
		sh_css_free(me);
			kvfree(me->data_ptr);
		kvfree(me);
	}
}

@@ -405,7 +405,7 @@ ia_css_isp_dvs_statistics_free(struct ia_css_isp_dvs_statistics *me)
{
	if (me) {
		hmm_free(me->data_ptr);
		sh_css_free(me);
		kvfree(me);
	}
}

+2 −2
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ ia_css_isp_dvs2_statistics_allocate(
	if (!grid->enable)
		return NULL;

	me = sh_css_calloc(1, sizeof(*me));
	me = kvcalloc(1, sizeof(*me), GFP_KERNEL);
	if (!me)
		goto err;

@@ -318,7 +318,7 @@ ia_css_isp_dvs2_statistics_free(struct ia_css_isp_dvs_statistics *me)
{
	if (me) {
		hmm_free(me->data_ptr);
		sh_css_free(me);
		kvfree(me);
	}
}

+3 −3
Original line number Diff line number Diff line
@@ -927,8 +927,8 @@ ia_css_binary_init_infos(void) {
	if (num_of_isp_binaries == 0)
		return IA_CSS_SUCCESS;

	all_binaries = sh_css_malloc(num_of_isp_binaries *
				     sizeof(*all_binaries));
	all_binaries = kvmalloc(num_of_isp_binaries * sizeof(*all_binaries),
				GFP_KERNEL);
	if (!all_binaries)
		return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;

@@ -966,7 +966,7 @@ ia_css_binary_uninit(void) {
		}
		binary_infos[i] = NULL;
	}
	sh_css_free(all_binaries);
	kvfree(all_binaries);
	return IA_CSS_SUCCESS;
}

+6 −6
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame,

error:
	if (err != IA_CSS_SUCCESS) {
		sh_css_free(me);
		kvfree(me);
		me = NULL;
	}

@@ -228,7 +228,7 @@ enum ia_css_err ia_css_frame_create_from_info(struct ia_css_frame **frame,
	err = ia_css_frame_init_planes(me);

	if (err != IA_CSS_SUCCESS) {
		sh_css_free(me);
		kvfree(me);
		me = NULL;
	}

@@ -321,7 +321,7 @@ void ia_css_frame_free(struct ia_css_frame *frame)

	if (frame) {
		hmm_free(frame->data);
		sh_css_free(frame);
		kvfree(frame);
	}

	IA_CSS_LEAVE_PRIVATE("void");
@@ -551,7 +551,7 @@ enum ia_css_err ia_css_frame_allocate_with_buffer_size(
	err = frame_allocate_buffer_data(me);

	if (err != IA_CSS_SUCCESS) {
		sh_css_free(me);
		kvfree(me);
		me = NULL;
	}

@@ -837,7 +837,7 @@ static enum ia_css_err frame_allocate_with_data(struct ia_css_frame **frame,
		err = frame_allocate_buffer_data(me);

	if (err != IA_CSS_SUCCESS) {
		sh_css_free(me);
		kvfree(me);
#ifndef ISP2401
		return err;
#else
@@ -858,7 +858,7 @@ static struct ia_css_frame *frame_create(unsigned int width,
	bool contiguous,
	bool valid)
{
	struct ia_css_frame *me = sh_css_malloc(sizeof(*me));
	struct ia_css_frame *me = kvmalloc(sizeof(*me), GFP_KERNEL);

	if (!me)
		return NULL;
Loading