Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit ff236f7a authored by Mikulas Patocka's avatar Mikulas Patocka Committed by David S. Miller
Browse files

sunhme: fix dma warning in Sun HME

Fix dma-api-checking warnings in Sun HME

Sun HME driver is mapping the first fragment with dma_map_single and subsequent
fragments with dma_map_page. It is unmapping all fragments with dma_unmap_single
and that produces the warning.

This patch changes it so that it unmaps only the first fragment with
dma_unmap_single and subsequent fragments are unmapped with dma_unmap_page.

WARNING: at lib/dma-debug.c:816 check_unmap+0x3ac/0x780()
hme 0000:01:01.1: DMA-API: device driver frees DMA memory with wrong function [device address=0x00000000c1082000] [size=32 bytes] [mapped as page] [unmapped as single]
Modules linked in: nbd sunhme openpromfs sermouse unix
Call Trace:
 [0000000000456910] warn_slowpath_common+0x50/0xa0
 [0000000000571f4c] check_unmap+0x3ac/0x780
 [0000000000572570] debug_dma_unmap_page+0x50/0x60
 [000000001002f5fc] happy_meal_tx+0x11c/0x260 [sunhme]
 [000000001002fc4c] happy_meal_interrupt+0xcc/0xe0 [sunhme]
 [0000000000492d94] handle_fasteoi_irq+0x74/0x100
...
parent 8818a9d8
No related merge requests found
......@@ -1226,10 +1226,16 @@ static void happy_meal_clean_rings(struct happy_meal *hp)
for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) {
txd = &hp->happy_block->happy_meal_txd[i];
dma_addr = hme_read_desc32(hp, &txd->tx_addr);
dma_unmap_single(hp->dma_dev, dma_addr,
(hme_read_desc32(hp, &txd->tx_flags)
& TXFLAG_SIZE),
DMA_TO_DEVICE);
if (!frag)
dma_unmap_single(hp->dma_dev, dma_addr,
(hme_read_desc32(hp, &txd->tx_flags)
& TXFLAG_SIZE),
DMA_TO_DEVICE);
else
dma_unmap_page(hp->dma_dev, dma_addr,
(hme_read_desc32(hp, &txd->tx_flags)
& TXFLAG_SIZE),
DMA_TO_DEVICE);
if (frag != skb_shinfo(skb)->nr_frags)
i++;
......@@ -1953,7 +1959,10 @@ static void happy_meal_tx(struct happy_meal *hp)
dma_len = hme_read_desc32(hp, &this->tx_flags);
dma_len &= TXFLAG_SIZE;
dma_unmap_single(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE);
if (!frag)
dma_unmap_single(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE);
else
dma_unmap_page(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE);
elem = NEXT_TX(elem);
this = &txbase[elem];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment