]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
arm64: Align CMA sizes to PAGE_SIZE
authorLaura Abbott <lauraa@codeaurora.org>
Tue, 4 Feb 2014 23:08:57 +0000 (23:08 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 5 Feb 2014 10:28:27 +0000 (10:28 +0000)
dma_alloc_from_contiguous takes number of pages for a size.
Align up the dma size passed in to page size to avoid truncation
and allocation failures on sizes less than PAGE_SIZE.

Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/mm/dma-mapping.c

index 45b5ab54c9eeb04730d363d13fc43a40d138aabe..fbd76785c5db640bf511a9647380ebb1ae29b3ef 100644 (file)
@@ -45,6 +45,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
        if (IS_ENABLED(CONFIG_DMA_CMA)) {
                struct page *page;
 
+               size = PAGE_ALIGN(size);
                page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT,
                                                        get_order(size));
                if (!page)