Skip to contentSkip to conversation

ALSA: intel_hdmi: Fix reference to PCM buffer address

PATCH Applied Zhen Ni 2 participants 2 messages Mar 2, 2022 Sound

lore
Share & tools
lore

Zhen Ni

author
#0 lore raw

PATCH 1/1 ALSA: intel_hdmi: 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.

---
 sound/x86/intel_hdmi_audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/x86/intel_hdmi_audio.c +1 -1
index 1c94eaff1931..4a3ff6468aa7 100644
@@ -1261,7 +1261,7 @@ static int had_pcm_mmap(struct snd_pcm_substream *substream,
 {
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 	return remap_pfn_range(vma, vma->vm_start,
-			substream->dma_buffer.addr >> PAGE_SHIFT,
+			substream->runtime->dma_addr >> PAGE_SHIFT,
 			vma->vm_end - vma->vm_start, vma->vm_page_prot);
 }
 
Signature · 1 line
2.20.1
Applied
#1 lore raw
Quoted 8 lines · Zhen Ni

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.

Thanks, applied now with Cc-to-stable.

I guess the had_pcm_mmap() can be dropped completely and replaced with the standard mmap helper, as what we really want is rather wc. But it can be done for 5.18.

Takashi