ALSA: Convert snd_malloc_dev_pages() to the mask allocator From: Luiz Fernando N. Capitulino The mask allocator do not handle the __GFP_COMP flag and will BUG_ON() if that flag is passed to it. Also, we should pass the allocation size in bytes to dma_alloc_coherent(). Signed-off-by: Luiz Fernando N. Capitulino Signed-off-by: Andi Kleen --- sound/core/memalloc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) Index: linux/sound/core/memalloc.c =================================================================== --- linux.orig/sound/core/memalloc.c +++ linux/sound/core/memalloc.c @@ -210,20 +210,17 @@ void snd_free_pages(void *ptr, size_t si /* allocate the coherent DMA pages */ static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *dma) { - int pg; void *res; gfp_t gfp_flags; snd_assert(size > 0, return NULL); snd_assert(dma != NULL, return NULL); - pg = get_order(size); gfp_flags = GFP_KERNEL - | __GFP_COMP /* compound page lets parts be mapped */ | __GFP_NORETRY /* don't trigger OOM-killer */ | __GFP_NOWARN; /* no stack trace print - this call is non-critical */ - res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags); + res = dma_alloc_coherent(dev, size, dma, gfp_flags); if (res != NULL) - inc_snd_pages(pg); + inc_snd_pages(get_order(size)); return res; }