diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-08-08 17:56:46 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-08-28 14:56:46 +0300 |
commit | 03486830c577d3fe49c1f2c316414552a549ff00 (patch) | |
tree | b0ce4337a31996992ff5a2be2f153c3c1ca9b039 /sound/core/memalloc.c | |
parent | b8e131542b47b81236ecf6768c923128e1f5db6e (diff) | |
download | linux-03486830c577d3fe49c1f2c316414552a549ff00.tar.xz |
ALSA: memalloc: Don't align the size to power-of-two
The size passed to dma_alloc_coherent() doesn't have to be aligned
with power-of-two, rather it should be the raw size. As a minor
optimization, remove the size adjustment in the current code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/memalloc.c')
-rw-r--r-- | sound/core/memalloc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 753d5fc4b284..d85df01bf055 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -84,29 +84,24 @@ EXPORT_SYMBOL(snd_free_pages); /* allocate the coherent DMA pages */ static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *dma) { - int pg; gfp_t gfp_flags; if (WARN_ON(!dma)) 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 */ - return dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags); + return dma_alloc_coherent(dev, size, dma, gfp_flags); } /* free the coherent DMA pages */ static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr, dma_addr_t dma) { - int pg; - if (ptr == NULL) return; - pg = get_order(size); - dma_free_coherent(dev, PAGE_SIZE << pg, ptr, dma); + dma_free_coherent(dev, size, ptr, dma); } #ifdef CONFIG_GENERIC_ALLOCATOR |