ALSA: memalloc: Fix dma_need_sync() checks
dma_need_sync() checks each DMA address. Fix the incorrect usages for non-contiguous and non-coherent page allocations. Fortunately, there are no actual call sites that need manual syncs yet. Fixes:a25684a956
("ALSA: memalloc: Support for non-contiguous page allocation") Fixes:73325f60e2
("ALSA: memalloc: Support for non-coherent page allocation") Cc: <stable@vger.kernel.org> Reported-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Link: https://lore.kernel.org/r/20220210123344.8756-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
52517d9c0c
Коммит
8e1741c658
|
@ -511,7 +511,8 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size)
|
||||||
DEFAULT_GFP, 0);
|
DEFAULT_GFP, 0);
|
||||||
if (!sgt)
|
if (!sgt)
|
||||||
return NULL;
|
return NULL;
|
||||||
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir);
|
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev,
|
||||||
|
sg_dma_address(sgt->sgl));
|
||||||
p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt);
|
p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt);
|
||||||
if (p)
|
if (p)
|
||||||
dmab->private_data = sgt;
|
dmab->private_data = sgt;
|
||||||
|
@ -671,9 +672,13 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = {
|
||||||
*/
|
*/
|
||||||
static void *snd_dma_noncoherent_alloc(struct snd_dma_buffer *dmab, size_t size)
|
static void *snd_dma_noncoherent_alloc(struct snd_dma_buffer *dmab, size_t size)
|
||||||
{
|
{
|
||||||
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir);
|
void *p;
|
||||||
return dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr,
|
|
||||||
|
p = dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr,
|
||||||
dmab->dev.dir, DEFAULT_GFP);
|
dmab->dev.dir, DEFAULT_GFP);
|
||||||
|
if (p)
|
||||||
|
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->addr);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_dma_noncoherent_free(struct snd_dma_buffer *dmab)
|
static void snd_dma_noncoherent_free(struct snd_dma_buffer *dmab)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче