Skip to content

Commit

Permalink
sparc32: page align size in arch_dma_alloc
Browse files Browse the repository at this point in the history
[ Upstream commit 59583f7 ]

Commit 53b7670 ("sparc: factor the dma coherent mapping into
helper") lost the page align for the calls to dma_make_coherent and
srmmu_unmapiorange. The latter cannot handle a non page aligned len
argument.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
andreas-gaisler authored and gregkh committed Sep 30, 2021
1 parent d268a18 commit 5780971
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/sparc/kernel/ioport.c
Expand Up @@ -356,7 +356,9 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t dma_addr, unsigned long attrs)
{
if (!sparc_dma_free_resource(cpu_addr, PAGE_ALIGN(size)))
size = PAGE_ALIGN(size);

if (!sparc_dma_free_resource(cpu_addr, size))
return;

dma_make_coherent(dma_addr, size);
Expand Down

0 comments on commit 5780971

Please sign in to comment.