Skip to content

Commit b8bceac

Browse files
tiwaigregkh
authored andcommitted
ASoC: intel: atom: Fix reference to PCM buffer address
commit 2e6b836 upstream. PCM buffers might be allocated dynamically when the buffer preallocation failed or a larger buffer is requested, and it's not guaranteed that substream->dma_buffer points to the actually used buffer. The address should be retrieved from runtime->dma_addr, instead of substream->dma_buffer (and shouldn't use virt_to_phys). Also, remove the line overriding runtime->dma_area superfluously, which was already set up at the PCM buffer allocation. Cc: Cezary Rojewski <cezary.rojewski@intel.com> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20210728112353.6675-3-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 261613e commit b8bceac

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎sound/soc/intel/atom/sst-mfld-platform-pcm.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream,
127127
snd_pcm_uframes_t period_size;
128128
ssize_t periodbytes;
129129
ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
130-
u32 buffer_addr = virt_to_phys(substream->dma_buffer.area);
130+
u32 buffer_addr = substream->runtime->dma_addr;
131131

132132
channels = substream->runtime->channels;
133133
period_size = substream->runtime->period_size;
@@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
233233
/* set codec params and inform SST driver the same */
234234
sst_fill_pcm_params(substream, &param);
235235
sst_fill_alloc_params(substream, &alloc_params);
236-
substream->runtime->dma_area = substream->dma_buffer.area;
237236
str_params.sparams = param;
238237
str_params.aparams = alloc_params;
239238
str_params.codec = SST_CODEC_TYPE_PCM;

0 commit comments

Comments
 (0)