[alsa-devel] [PATCH v3 08/11] ASoC: SOF: Generic probe compress operations

Cezary Rojewski cezary.rojewski at intel.com
Wed Jan 29 10:04:36 CET 2020


On 2020-01-29 08:48, Daniel Baluta wrote:
> One comment below:

Thanks for review Daniel!

> 
>> +int sof_probe_compr_set_params(struct snd_compr_stream *cstream,
>> +		struct snd_compr_params *params, struct snd_soc_dai
>> *dai)
>> +{
>> +	struct snd_compr_runtime *rtd = cstream->runtime;
>> +	struct snd_sof_dev *sdev =
>> +				snd_soc_component_get_drvdata(dai-
>>> component);
>> +	int ret;
>> +
>> +	cstream->dma_buffer.dev.type = SNDRV_DMA_TYPE_DEV_SG;
>> +	cstream->dma_buffer.dev.dev = sdev->dev;
>> +	ret = snd_compr_malloc_pages(cstream, rtd->buffer_size);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	ret = snd_sof_probe_compr_set_params(sdev, cstream, params,
>> dai);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	ret = sof_ipc_probe_init(sdev, sdev->extractor_stream_tag,
>> +				 rtd->dma_bytes);
>> +	if (ret < 0) {
>> +		dev_err(dai->dev, "Failed to init probe: %d\n", ret);
>> +		return ret;
>> +	}
>>
> 
> Should we call snd_compr_free_pages on error case?
> 

_set_params() failure is automatically followed by _free(). This is done 
by the compr core. As you can see in the _free() itself, regardless of 
IPCs outcome, code will get to _free_pages() and thus all occupied 
resources are released.

Czarek


More information about the Alsa-devel mailing list