Skip to content

Commit 4da059e

Browse files
Jyri Sarhakv2019i
authored andcommitted
module: Make mod_zalloc() inline function
Make mod_zalloc() inline function. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 64879dd commit 4da059e

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/audio/module_adapter/module/generic.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -261,25 +261,6 @@ void *mod_alloc_align(struct processing_module *mod, size_t size, size_t alignme
261261
}
262262
EXPORT_SYMBOL(mod_alloc_align);
263263

264-
/**
265-
* Allocates memory block for module and initializes it to zero.
266-
* @param mod Pointer to module this memory block is allocated for.
267-
* @param bytes Size in bytes.
268-
* @return Pointer to the allocated memory or NULL if failed.
269-
*
270-
* Like mod_alloc() but the allocated memory is initialized to zero.
271-
*/
272-
void *mod_zalloc(struct processing_module *mod, size_t size)
273-
{
274-
void *ret = mod_alloc(mod, size);
275-
276-
if (ret)
277-
memset(ret, 0, size);
278-
279-
return ret;
280-
}
281-
EXPORT_SYMBOL(mod_zalloc);
282-
283264
/**
284265
* Creates a blob handler and releases it when the module is unloaded
285266
* @param mod Pointer to module this memory block is allocated for.

src/include/sof/audio/module_adapter/module/generic.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,16 @@ static inline void *mod_alloc(struct processing_module *mod, size_t size)
200200
return mod_alloc_align(mod, size, 0);
201201
}
202202

203-
void *mod_zalloc(struct processing_module *mod, size_t size);
203+
static inline void *mod_zalloc(struct processing_module *mod, size_t size)
204+
{
205+
void *ret = mod_alloc(mod, size);
206+
207+
if (ret)
208+
memset(ret, 0, size);
209+
210+
return ret;
211+
}
212+
204213
int mod_free(struct processing_module *mod, const void *ptr);
205214
#if CONFIG_COMP_BLOB
206215
struct comp_data_blob_handler *mod_data_blob_handler_new(struct processing_module *mod);

0 commit comments

Comments
 (0)