aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2024-04-05 11:09:20 +0200
committerMark Brown <broonie@kernel.org>2024-04-05 13:13:04 +0100
commitbeeeee9686affef32ee04d8ae30db8c53cbc7aee (patch)
tree287bdbfd0523cea352c65a6600ed252ebee27c77
parent6dd68c2da44d92c25b323bcc2603421463437a64 (diff)
downloadsound-beeeee9686affef32ee04d8ae30db8c53cbc7aee.tar.gz
ASoC: Intel: avs: Fix config_length for config-less copiers
Copier's config_length shall always be at least one even if there is no configuration payload to carry. While the firmware treats config_length=0 or 1 in the same manner, the driver shall initialize the module properly. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://msgid.link/r/20240405090929.1184068-5-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/avs/path.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 5944865a1193db..9bd03a44fcb972 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -148,11 +148,12 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
struct avs_copier_cfg *cfg;
struct nhlt_specific_cfg *ep_blob;
union avs_connector_node_id node_id = {0};
- size_t cfg_size, data_size = 0;
+ size_t cfg_size, data_size;
void *data = NULL;
u32 dma_type;
int ret;
+ data_size = sizeof(cfg->gtw_cfg.config);
dma_type = t->cfg_ext->copier.dma_type;
node_id.dma_type = dma_type;
@@ -233,10 +234,7 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
break;
}
- cfg_size = sizeof(*cfg) + data_size;
- /* Every config-BLOB contains gateway attributes. */
- if (data_size)
- cfg_size -= sizeof(cfg->gtw_cfg.config.attrs);
+ cfg_size = offsetof(struct avs_copier_cfg, gtw_cfg.config) + data_size;
if (cfg_size > AVS_MAILBOX_SIZE)
return -EINVAL;