diff options
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c2cdf6500f75..4e7d1182e8a3 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -358,7 +358,7 @@ void __init dma_contiguous_remap(void) | |||
358 | if (end > arm_lowmem_limit) | 358 | if (end > arm_lowmem_limit) |
359 | end = arm_lowmem_limit; | 359 | end = arm_lowmem_limit; |
360 | if (start >= end) | 360 | if (start >= end) |
361 | return; | 361 | continue; |
362 | 362 | ||
363 | map.pfn = __phys_to_pfn(start); | 363 | map.pfn = __phys_to_pfn(start); |
364 | map.virtual = __phys_to_virt(start); | 364 | map.virtual = __phys_to_virt(start); |
@@ -423,7 +423,7 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page) | |||
423 | unsigned int pageno; | 423 | unsigned int pageno; |
424 | unsigned long flags; | 424 | unsigned long flags; |
425 | void *ptr = NULL; | 425 | void *ptr = NULL; |
426 | size_t align; | 426 | unsigned long align_mask; |
427 | 427 | ||
428 | if (!pool->vaddr) { | 428 | if (!pool->vaddr) { |
429 | WARN(1, "coherent pool not initialised!\n"); | 429 | WARN(1, "coherent pool not initialised!\n"); |
@@ -435,11 +435,11 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page) | |||
435 | * small, so align them to their order in pages, minimum is a page | 435 | * small, so align them to their order in pages, minimum is a page |
436 | * size. This helps reduce fragmentation of the DMA space. | 436 | * size. This helps reduce fragmentation of the DMA space. |
437 | */ | 437 | */ |
438 | align = PAGE_SIZE << get_order(size); | 438 | align_mask = (1 << get_order(size)) - 1; |
439 | 439 | ||
440 | spin_lock_irqsave(&pool->lock, flags); | 440 | spin_lock_irqsave(&pool->lock, flags); |
441 | pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages, | 441 | pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages, |
442 | 0, count, (1 << align) - 1); | 442 | 0, count, align_mask); |
443 | if (pageno < pool->nr_pages) { | 443 | if (pageno < pool->nr_pages) { |
444 | bitmap_set(pool->bitmap, pageno, count); | 444 | bitmap_set(pool->bitmap, pageno, count); |
445 | ptr = pool->vaddr + PAGE_SIZE * pageno; | 445 | ptr = pool->vaddr + PAGE_SIZE * pageno; |
@@ -648,12 +648,12 @@ void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, | |||
648 | 648 | ||
649 | if (arch_is_coherent() || nommu()) { | 649 | if (arch_is_coherent() || nommu()) { |
650 | __dma_free_buffer(page, size); | 650 | __dma_free_buffer(page, size); |
651 | } else if (__free_from_pool(cpu_addr, size)) { | ||
652 | return; | ||
651 | } else if (!IS_ENABLED(CONFIG_CMA)) { | 653 | } else if (!IS_ENABLED(CONFIG_CMA)) { |
652 | __dma_free_remap(cpu_addr, size); | 654 | __dma_free_remap(cpu_addr, size); |
653 | __dma_free_buffer(page, size); | 655 | __dma_free_buffer(page, size); |
654 | } else { | 656 | } else { |
655 | if (__free_from_pool(cpu_addr, size)) | ||
656 | return; | ||
657 | /* | 657 | /* |
658 | * Non-atomic allocations cannot be freed with IRQs disabled | 658 | * Non-atomic allocations cannot be freed with IRQs disabled |
659 | */ | 659 | */ |