diff options
author | Mark Brown <broonie@kernel.org> | 2022-06-14 13:25:45 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-06-14 13:25:45 +0300 |
commit | 14cc5849120051caf537f663ec620910503bb719 (patch) | |
tree | f786cd254d3a6dc104976b03e05b381d9fe5cc16 /sound/soc/sof/ipc3-topology.c | |
parent | 7ed1f83bb4f05fe460984ae49e98d1c1be38fb5f (diff) | |
parent | da440af07fc3dd2b5a5138671eba51991dd1fac8 (diff) | |
download | linux-14cc5849120051caf537f663ec620910503bb719.tar.xz |
ASoC: Merge fixes
Required for more changes for the ops.
Diffstat (limited to 'sound/soc/sof/ipc3-topology.c')
-rw-r--r-- | sound/soc/sof/ipc3-topology.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 5ee1537f9c2d..28d3c1414572 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -1593,24 +1593,23 @@ static int sof_ipc3_control_load_bytes(struct snd_sof_dev *sdev, struct snd_sof_ struct sof_ipc_ctrl_data *cdata; int ret; - scontrol->ipc_control_data = kzalloc(scontrol->max_size, GFP_KERNEL); - if (!scontrol->ipc_control_data) - return -ENOMEM; - - if (scontrol->max_size < sizeof(*cdata) || - scontrol->max_size < sizeof(struct sof_abi_hdr)) { - ret = -EINVAL; - goto err; + if (scontrol->max_size < (sizeof(*cdata) + sizeof(struct sof_abi_hdr))) { + dev_err(sdev->dev, "%s: insufficient size for a bytes control: %zu.\n", + __func__, scontrol->max_size); + return -EINVAL; } - /* init the get/put bytes data */ if (scontrol->priv_size > scontrol->max_size - sizeof(*cdata)) { - dev_err(sdev->dev, "err: bytes data size %zu exceeds max %zu.\n", + dev_err(sdev->dev, + "%s: bytes data size %zu exceeds max %zu.\n", __func__, scontrol->priv_size, scontrol->max_size - sizeof(*cdata)); - ret = -EINVAL; - goto err; + return -EINVAL; } + scontrol->ipc_control_data = kzalloc(scontrol->max_size, GFP_KERNEL); + if (!scontrol->ipc_control_data) + return -ENOMEM; + scontrol->size = sizeof(struct sof_ipc_ctrl_data) + scontrol->priv_size; cdata = scontrol->ipc_control_data; |