From f748461ffce8cf36c525b9a2ce74ab4aea34f3e0 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 18 Oct 2022 14:27:59 +0200 Subject: [PATCH] volume: don't modify IPC data In volume_init() use a temporary local array instead of modifying IPC data, that can be stored in a host IPC memory window. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module/volume/volume.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/audio/module_adapter/module/volume/volume.c b/src/audio/module_adapter/module/volume/volume.c index 278285ff6..ce0837840 100644 --- a/src/audio/module_adapter/module/volume/volume.c +++ b/src/audio/module_adapter/module/volume/volume.c @@ -541,6 +541,7 @@ static int volume_init(struct processing_module *mod) struct module_config *cfg = &md->cfg; struct comp_dev *dev = mod->dev; struct ipc4_peak_volume_module_cfg *vol = cfg->data; + uint32_t target_volume[SOF_IPC_MAX_CHANNELS]; struct vol_data *cd; const size_t vol_size = sizeof(int32_t) * SOF_IPC_MAX_CHANNELS * 4; uint32_t channels_count; @@ -575,16 +576,16 @@ static int volume_init(struct processing_module *mod) else channel_cfg = channel; - vol->config[channel].target_volume = + target_volume[channel] = convert_volume_ipc4_to_ipc3(dev, vol->config[channel].target_volume); set_volume_ipc4(cd, channel, - vol->config[channel_cfg].target_volume, + target_volume[channel_cfg], vol->config[channel_cfg].curve_type, vol->config[channel_cfg].curve_duration); } - init_ramp(cd, vol->config[0].curve_duration, vol->config[0].target_volume); + init_ramp(cd, vol->config[0].curve_duration, target_volume[0]); instance_id = IPC4_INST_ID(dev_comp_id(dev)); if (instance_id >= IPC4_MAX_PEAK_VOL_REG_SLOTS) {