audio: components: Allocate correct device size

The devices sizes can be variable depending on any IPC init data that is
stored. Make sure we allocate the correct size.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2017-06-09 17:27:02 +01:00
parent 6a24a293c6
commit 1764152119
5 changed files with 11 additions and 5 deletions

View File

@ -181,7 +181,8 @@ static struct comp_dev *dai_new_ssp(struct sof_ipc_comp *comp)
struct dai_data *dd;
struct sof_ipc_comp_dai *dai = (struct sof_ipc_comp_dai *)comp;
dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev));
dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
COMP_SIZE(struct sof_ipc_comp_dai));
if (dev == NULL)
return NULL;
memcpy(&dev->comp, comp, sizeof(struct sof_ipc_comp_dai));

View File

@ -230,7 +230,8 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)
trace_host("new");
dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev));
dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
COMP_SIZE(struct sof_ipc_comp_host));
if (dev == NULL)
return NULL;
memcpy(&dev->comp, comp, sizeof(struct sof_ipc_comp_host));

View File

@ -87,7 +87,8 @@ static struct comp_dev *mixer_new(struct sof_ipc_comp *comp)
struct mixer_data *md;
trace_mixer("new");
dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev));
dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
COMP_SIZE(struct sof_ipc_comp_mixer));
if (dev == NULL)
return NULL;

View File

@ -42,6 +42,7 @@
#include <reef/clock.h>
#include <reef/audio/component.h>
#include <reef/audio/pipeline.h>
#include <uapi/ipc.h>
#include "src_core.h"
#ifdef MODULE_TEST
@ -260,7 +261,8 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp)
struct comp_data *cd;
trace_src("SNw");
dev = rmalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev));
dev = rmalloc(RZONE_RUNTIME, RFLAGS_NONE,
COMP_SIZE(struct sof_ipc_comp_src));
if (dev == NULL)
return NULL;

View File

@ -327,7 +327,8 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp)
trace_volume("new");
dev = rmalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev));
dev = rmalloc(RZONE_RUNTIME, RFLAGS_NONE,
COMP_SIZE(struct sof_ipc_comp_volume));
if (dev == NULL)
return NULL;
memcpy(&dev->comp, comp, sizeof(struct sof_ipc_comp_volume));