[Sound-open-firmware] [PATCH] 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 --- src/audio/dai.c | 3 ++- src/audio/host.c | 3 ++- src/audio/mixer.c | 3 ++- src/audio/src.c | 4 +++- src/audio/volume.c | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/audio/dai.c b/src/audio/dai.c index d02e365..1e05c1d 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -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)); diff --git a/src/audio/host.c b/src/audio/host.c index 9f81a1c..bf7eb4b 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -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)); diff --git a/src/audio/mixer.c b/src/audio/mixer.c index f3891aa..478f00c 100644 --- a/src/audio/mixer.c +++ b/src/audio/mixer.c @@ -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;
diff --git a/src/audio/src.c b/src/audio/src.c index 7a86a54..6e2a737 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -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;
diff --git a/src/audio/volume.c b/src/audio/volume.c index d1d804a..c59e34b 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -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));
participants (1)
-
Liam Girdwood