Skip to content

Commit b617c0f

Browse files
Jyri Sarhalgirdwood
authored andcommitted
modules: tensorflow: Memory, blob, and fast_get allocs to module API
Allocate all memory, blob handlers, and fast_get() buffers through module API mod_alloc() and friends. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 365af8a commit b617c0f

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/audio/tensorflow/tflm-classify.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <ipc/stream.h>
1919
#include <ipc/topology.h>
2020
#include <module/module/llext.h>
21-
#include <rtos/alloc.h>
2221
#include <rtos/init.h>
2322
#include <rtos/panic.h>
2423
#include <rtos/string.h>
@@ -61,16 +60,16 @@ __cold static int tflm_init(struct processing_module *mod)
6160

6261
comp_info(dev, "tflm_init()");
6362

64-
cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
63+
cd = mod_zalloc(mod, sizeof(*cd));
6564
if (!cd)
6665
return -ENOMEM;
6766

6867
md->private = cd;
6968

7069
/* Handler for configuration data */
71-
cd->model_handler = comp_data_blob_handler_new(dev);
70+
cd->model_handler = mod_data_blob_handler_new(mod);
7271
if (!cd->model_handler) {
73-
comp_err(dev, "comp_data_blob_handler_new() failed.");
72+
comp_err(dev, "mod_data_blob_handler_new() failed.");
7473
ret = -ENOMEM;
7574
goto cd_fail;
7675
}
@@ -102,7 +101,7 @@ __cold static int tflm_init(struct processing_module *mod)
102101
return ret;
103102

104103
cd_fail:
105-
rfree(cd);
104+
mod_free(mod, cd);
106105
return ret;
107106
}
108107

@@ -112,8 +111,8 @@ __cold static int tflm_free(struct processing_module *mod)
112111

113112
assert_can_be_cold();
114113

115-
comp_data_blob_handler_free(cd->model_handler);
116-
rfree(cd);
114+
mod_data_blob_handler_free(mod, cd->model_handler);
115+
mod_free(mod, cd);
117116
return 0;
118117
}
119118

0 commit comments

Comments
 (0)