Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1da439c authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Christoph Hellwig
Browse files

dma-mapping: fix lack of DMA address assignment in generic remap allocator



Commit bfd56cd6 ("dma-mapping: support highmem in the generic remap
allocator") replaced dma_direct_alloc_pages() with __dma_direct_alloc_pages(),
which doesn't set dma_handle and zero allocated memory. Fix it by doing this
directly in the caller function.

Fixes: bfd56cd6 ("dma-mapping: support highmem in the generic remap allocator")
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Tested-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent f04b951f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -223,11 +223,17 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
	ret = dma_common_contiguous_remap(page, size, VM_USERMAP,
			arch_dma_mmap_pgprot(dev, PAGE_KERNEL, attrs),
			__builtin_return_address(0));
	if (!ret)
	if (!ret) {
		__dma_direct_free_pages(dev, size, page);
		return ret;
	}

	*dma_handle = phys_to_dma(dev, page_to_phys(page));
	memset(ret, 0, size);

	return ret;
}

void arch_dma_free(struct device *dev, size_t size, void *vaddr,
		dma_addr_t dma_handle, unsigned long attrs)
{