Skip to content

Commit 3306877

Browse files
author
Christoph Hellwig
committed
ALSA: memalloc: don't pass bogus GFP_ flags to dma_alloc_*
dma_alloc_coherent/dma_alloc_wc is an opaque allocator that only uses the GFP_ flags for allocation context control. Don't pass __GFP_COMP which makes no sense for an allocation that can't in any way be converted to a page pointer. Note that for dma_alloc_noncoherent and dma_alloc_noncontigous in combination with the DMA mmap helpers __GFP_COMP looks sketchy as well, so I would suggest to drop that as well after a careful audit. Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent c08004e commit 3306877

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sound/core/memalloc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
#define DEFAULT_GFP \
2222
(GFP_KERNEL | \
23-
__GFP_COMP | /* compound page lets parts be mapped */ \
2423
__GFP_RETRY_MAYFAIL | /* don't trigger OOM-killer */ \
2524
__GFP_NOWARN) /* no stack trace print - this call is non-critical */
2625

@@ -542,7 +541,7 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size)
542541
void *p;
543542

544543
sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
545-
DEFAULT_GFP, 0);
544+
DEFAULT_GFP | __GFP_COMP, 0);
546545
if (!sgt) {
547546
#ifdef CONFIG_SND_DMA_SGBUF
548547
if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
@@ -810,7 +809,7 @@ static void *snd_dma_noncoherent_alloc(struct snd_dma_buffer *dmab, size_t size)
810809
void *p;
811810

812811
p = dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr,
813-
dmab->dev.dir, DEFAULT_GFP);
812+
dmab->dev.dir, DEFAULT_GFP | __GFP_COMP);
814813
if (p)
815814
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->addr);
816815
return p;

0 commit comments

Comments
 (0)