Re: [PATCH v2] ASoC: loongson: Fix invalid position error in ls_pcm_pointer
From: Mark Brown
Date: Mon Jun 01 2026 - 14:47:03 EST
On Mon, Jun 01, 2026 at 04:43:09PM +0800, Li Jun wrote:
> The "invalid position" error occurred when the DMA position descriptor
> returned an invalid address value (e.g., pos = -1048838144). This happened
> because the `bytes_to_frames()` function returns a signed value, but when
> `addr < runtime->dma_addr`, the subtraction produces a negative result that
> gets interpreted as a large unsigned integer in comparisons.
> when the addr is abnormal, for example,the DMA controller is abnormal in
> hardware,x=0 should not be a point(x == runtime->buffer_size),but a range,
> which includes the addr address being less than runtime ->dma1-adr, and
> the addr exceeding the DMA address range.
I'm not clear in what circumstances we see an address that's outside the
DMA buffer? Is this an error that should be reported as an XRUN instead
of silently masked (which will presumably lead to audible issues)?
Attachment:
signature.asc
Description: PGP signature