Skip to content

Commit d7262eb

Browse files
author
Jyri Sarha
committed
module: Make mod_zalloc() inline function
Make mod_zalloc() inline function. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 519c8ab commit d7262eb

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-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: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,15 @@ static inline void *mod_alloc(struct processing_module *mod, size_t size)
198198
{
199199
return mod_alloc_align(mod, size, 0);
200200
}
201-
void *mod_zalloc(struct processing_module *mod, size_t size);
201+
static inline void *mod_zalloc(struct processing_module *mod, size_t size)
202+
{
203+
void *ret = mod_alloc(mod, size);
204+
205+
if (ret)
206+
memset(ret, 0, size);
207+
208+
return ret;
209+
}
202210
int mod_free(struct processing_module *mod, const void *ptr);
203211
#if CONFIG_COMP_BLOB
204212
struct comp_data_blob_handler *mod_data_blob_handler_new(struct processing_module *mod);

0 commit comments

Comments
 (0)