Re: [PATCH v3] ASoC: SOF: ipc3-topology: Correct get_control_data for non bytes payload

Sergey Senozhatsky
2022-04-27T13:14:43Z

On (22/04/27 15:40), Peter Ujfalusi wrote:
[..]
> struct sof_widget_data {
> int ctrl_type;
> int ipc_cmd;
> - struct sof_abi_hdr *pdata;
> + void *pdata;
> + size_t pdata_size;
> struct snd_sof_control *control;
> };
>
> @@ -784,16 +785,26 @@ static int sof_get_control_data(struct snd_soc_component *scomp,
> }
>
> cdata = wdata[i].control->ipc_control_data;
> - wdata[i].pdata = cdata->data;
> - if (!wdata[i].pdata)
> - return -EINVAL;
>
> /* make sure data is valid - data can be updated at runtime */

A silly nit: does this comment belong to SOF_ABI_MAGIC check below?

> - if (widget->dobj.widget.kcontrol_type[i] == SND_SOC_TPLG_TYPE_BYTES &&
> - wdata[i].pdata->magic != SOF_ABI_MAGIC)
> - return -EINVAL;
> + if (widget->dobj.widget.kcontrol_type[i] == SND_SOC_TPLG_TYPE_BYTES) {
> + if (cdata->data->magic != SOF_ABI_MAGIC)
> + return -EINVAL;