Skip to content

Commit 8b5d953

Browse files
tiwaibroonie
authored andcommitted
ASoC: amd: Fix reference to PCM buffer address
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 driver needs to refer to substream->runtime->dma_addr instead for the buffer address. Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1d25684 commit 8b5d953

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

sound/soc/amd/acp-pcm-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component,
969969

970970
acp_set_sram_bank_state(rtd->acp_mmio, 0, true);
971971
/* Save for runtime private data */
972-
rtd->dma_addr = substream->dma_buffer.addr;
972+
rtd->dma_addr = runtime->dma_addr;
973973
rtd->order = get_order(size);
974974

975975
/* Fill the page table entries in ACP SRAM */

sound/soc/amd/raven/acp3x-pcm-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component,
286286
pr_err("pinfo failed\n");
287287
}
288288
size = params_buffer_bytes(params);
289-
rtd->dma_addr = substream->dma_buffer.addr;
289+
rtd->dma_addr = substream->runtime->dma_addr;
290290
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
291291
config_acp3x_dma(rtd, substream->stream);
292292
return 0;

sound/soc/amd/renoir/acp3x-pdm-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int acp_pdm_dma_hw_params(struct snd_soc_component *component,
242242
return -EINVAL;
243243
size = params_buffer_bytes(params);
244244
period_bytes = params_period_bytes(params);
245-
rtd->dma_addr = substream->dma_buffer.addr;
245+
rtd->dma_addr = substream->runtime->dma_addr;
246246
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
247247
config_acp_dma(rtd, substream->stream);
248248
init_pdm_ring_buffer(MEM_WINDOW_START, size, period_bytes,

0 commit comments

Comments
 (0)