kernel: fix more bgmac dma init/cleanup issues

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45422
This commit is contained in:
Felix Fietkau
2015-04-13 20:08:30 +00:00
parent 232c61742e
commit 87f854059a
6 changed files with 32 additions and 9 deletions

View File

@@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
- slot->dma_addr,
- BGMAC_RX_BUF_SIZE,
- DMA_FROM_DEVICE);
+ kfree(buf);
+ put_page(virt_to_head_page(buf));
break;
}
@@ -99,3 +99,23 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
}
return handled;
@@ -528,14 +512,14 @@ static void bgmac_dma_rx_ring_free(struc
for (i = 0; i < ring->num_slots; i++) {
slot = &ring->slots[i];
- if (!slot->buf)
+ if (!slot->dma_addr)
continue;
- if (slot->dma_addr)
- dma_unmap_single(dma_dev, slot->dma_addr,
- BGMAC_RX_BUF_SIZE,
- DMA_FROM_DEVICE);
+ dma_unmap_single(dma_dev, slot->dma_addr,
+ BGMAC_RX_BUF_SIZE,
+ DMA_FROM_DEVICE);
put_page(virt_to_head_page(slot->buf));
+ slot->dma_addr = 0;
}
}