1
0
Fork 0

dma-direct: don't retry allocation for no-op GFP_DMA

When an allocation with lower dma_coherent mask fails, dma_direct_alloc()
retries the allocation with GFP_DMA.  But, this is useless for
architectures that hav no ZONE_DMA.

Fix it by adding the check of CONFIG_ZONE_DMA before retrying the
allocation.

Fixes: 95f183916d ("dma-direct: retry allocations using GFP_DMA for small masks")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
hifive-unleashed-5.1
Takashi Iwai 2018-04-15 11:08:07 +02:00 committed by Christoph Hellwig
parent 6d08b06e67
commit 504a918e67
1 changed files with 2 additions and 1 deletions

View File

@ -84,7 +84,8 @@ again:
__free_pages(page, page_order);
page = NULL;
if (dev->coherent_dma_mask < DMA_BIT_MASK(32) &&
if (IS_ENABLED(CONFIG_ZONE_DMA) &&
dev->coherent_dma_mask < DMA_BIT_MASK(32) &&
!(gfp & GFP_DMA)) {
gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
goto again;