Skip to content

Commit

Permalink
sparc32: page align size in arch_dma_alloc
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Sam Ravnborg <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
andreas-gaisler authored and Christoph Hellwig committed Sep 14, 2021
1 parent 510e1a7 commit 59583f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/sparc/kernel/ioport.c
Original file line number Diff line number Diff line change
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 59583f7

Please sign in to comment.