Skip to content

Commit

Permalink
sparc32: dma_alloc_coherent must honour gfp flags
Browse files Browse the repository at this point in the history
dma_zalloc_coherent() calls dma_alloc_coherent(__GFP_ZERO)
but the sparc32 implementations sbus_alloc_coherent() and
pci32_alloc_coherent() doesn't take the gfp flags into
account.

Tested on the SPARC32/LEON GRETH Ethernet driver which fails
due to dma_alloc_coherent(__GFP_ZERO) returns non zeroed
pages.

Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Hellstrom authored and David S. Miller committed Sep 10, 2014
1 parent b84ca92 commit d110528
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/sparc/kernel/ioport.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ static void *sbus_alloc_coherent(struct device *dev, size_t len,
}

order = get_order(len_total);
if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
va = __get_free_pages(gfp, order);
if (va == 0)
goto err_nopages;

if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
Expand Down Expand Up @@ -443,7 +444,7 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
}

order = get_order(len_total);
va = (void *) __get_free_pages(GFP_KERNEL, order);
va = (void *) __get_free_pages(gfp, order);
if (va == NULL) {
printk("pci_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT);
goto err_nopages;
Expand Down

0 comments on commit d110528

Please sign in to comment.