Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/audio/chain_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ __cold static struct comp_dev *chain_task_create(const struct comp_driver *drv,

rfree(cd);
error:
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -683,7 +683,7 @@ __cold static void chain_task_free(struct comp_dev *dev)

chain_release(dev);
rfree(cd);
rfree(dev);
comp_free_device(dev);
}

static const struct comp_driver comp_chain_dma = {
Expand Down
6 changes: 3 additions & 3 deletions src/audio/dai-legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static struct comp_dev *dai_new(const struct comp_driver *drv,

dd = rzalloc(SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT, sizeof(*dd));
if (!dd) {
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -211,7 +211,7 @@ static struct comp_dev *dai_new(const struct comp_driver *drv,

error:
rfree(dd);
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand Down Expand Up @@ -248,7 +248,7 @@ static void dai_free(struct comp_dev *dev)
dai_common_free(dd);

rfree(dd);
rfree(dev);
comp_free_device(dev);
}

int dai_common_get_hw_params(struct dai_data *dd, struct comp_dev *dev,
Expand Down
4 changes: 2 additions & 2 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ __cold static struct comp_dev *dai_new(const struct comp_driver *drv,
error:
rfree(dd);
e_data:
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand Down Expand Up @@ -630,7 +630,7 @@ __cold static void dai_free(struct comp_dev *dev)
dai_common_free(dd);

rfree(dd);
rfree(dev);
comp_free_device(dev);
}

int dai_common_get_hw_params(struct dai_data *dd, struct comp_dev *dev,
Expand Down
4 changes: 2 additions & 2 deletions src/audio/google/google_hotword_detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static struct comp_dev *ghd_create(const struct comp_driver *drv,
ipc_msg_free(cd->msg);
rfree(cd);
fail:
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -147,7 +147,7 @@ static void ghd_free(struct comp_dev *dev)
comp_data_blob_handler_free(cd->model_handler);
ipc_msg_free(cd->msg);
rfree(cd);
rfree(dev);
comp_free_device(dev);
}

static int ghd_params(struct comp_dev *dev,
Expand Down
4 changes: 2 additions & 2 deletions src/audio/host-legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ static struct comp_dev *host_new(const struct comp_driver *drv,
e_dev:
rfree(hd);
e_data:
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -612,7 +612,7 @@ static void host_free(struct comp_dev *dev)
comp_dbg(dev, "entry");
host_common_free(hd);
rfree(hd);
rfree(dev);
comp_free_device(dev);
}

static int host_elements_reset(struct host_data *hd, struct comp_dev *dev)
Expand Down
4 changes: 2 additions & 2 deletions src/audio/host-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ __cold static struct comp_dev *host_new(const struct comp_driver *drv,
e_dev:
rfree(hd);
e_data:
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -798,7 +798,7 @@ __cold static void host_free(struct comp_dev *dev)
comp_dbg(dev, "entry");
host_common_free(hd);
rfree(hd);
rfree(dev);
comp_free_device(dev);
}

static int host_elements_reset(struct host_data *hd, int direction)
Expand Down
8 changes: 4 additions & 4 deletions src/audio/kpb.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,15 @@ static struct comp_dev *kpb_new(const struct comp_driver *drv,

kpb = rzalloc(SOF_MEM_FLAG_USER, sizeof(*kpb));
if (!kpb) {
rfree(dev);
comp_free_device(dev);
return NULL;
}

comp_set_drvdata(dev, kpb);

ret = kpb_set_verify_ipc_params(dev, ipc_process);
if (ret) {
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand Down Expand Up @@ -544,7 +544,7 @@ static struct comp_dev *kpb_new(const struct comp_driver *drv,
/* retrieve params from the base config for IPC4 */
ret = kpb_params(dev, &params);
if (ret < 0) {
rfree(dev);
comp_free_device(dev);
return NULL;
}
#endif
Expand Down Expand Up @@ -720,7 +720,7 @@ static void kpb_free(struct comp_dev *dev)

/* Free KPB */
rfree(kpb);
rfree(dev);
comp_free_device(dev);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/audio/selector/selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static struct comp_dev *selector_new(const struct comp_driver *drv,

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
if (!cd) {
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -172,7 +172,7 @@ static struct comp_dev *selector_new(const struct comp_driver *drv,
ret = memcpy_s(&cd->config, sizeof(cd->config), ipc_process->data, bs);
if (ret) {
rfree(cd);
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -191,7 +191,7 @@ static void selector_free(struct comp_dev *dev)
comp_dbg(dev, "entry");

rfree(cd);
rfree(dev);
comp_free_device(dev);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/audio/tone/tone-ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static struct comp_dev *tone_new(const struct comp_driver *drv,

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
if (!cd) {
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -82,7 +82,7 @@ static void tone_free(struct comp_dev *dev)
comp_info(dev, "entry");

rfree(td);
rfree(dev);
comp_free_device(dev);
}

/* set component audio stream parameters */
Expand Down
13 changes: 13 additions & 0 deletions src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,19 @@ static inline struct comp_dev *comp_alloc(const struct comp_driver *drv, size_t
return dev;
}

/**
* Frees memory allocated for component device.
*
* This is a counterpart to comp_alloc() and not to be confused with
* comp_free().
*
* @param dev Pointer to the component device.
*/
static inline void comp_free_device(struct comp_dev *dev)
{
sof_heap_free(dev->drv->user_heap, dev);
}

/**
* \brief Module adapter associated with a component
* @param dev Component device
Expand Down
4 changes: 2 additions & 2 deletions src/samples/audio/detect_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ static struct comp_dev *test_keyword_new(const struct comp_driver *drv,
comp_data_blob_handler_free(cd->model_handler);
rfree(cd);
fail:
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand All @@ -788,7 +788,7 @@ static void test_keyword_free(struct comp_dev *dev)
ipc_msg_free(cd->msg);
comp_data_blob_handler_free(cd->model_handler);
rfree(cd);
rfree(dev);
comp_free_device(dev);
}

static int test_keyword_verify_params(struct comp_dev *dev,
Expand Down
4 changes: 2 additions & 2 deletions src/samples/audio/smart_amp_test_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static struct comp_dev *smart_amp_new(const struct comp_driver *drv,
comp_data_blob_handler_free(sad->model_handler);
rfree(sad);
fail:
rfree(dev);
comp_free_device(dev);
return NULL;
}

Expand Down Expand Up @@ -261,7 +261,7 @@ static void smart_amp_free(struct comp_dev *dev)
comp_data_blob_handler_free(sad->model_handler);

rfree(sad);
rfree(dev);
comp_free_device(dev);
}

static int smart_amp_verify_params(struct comp_dev *dev,
Expand Down