summaryrefslogtreecommitdiffstats
path: root/drivers/net/acenic.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2010-04-01 00:13:05 +0200
committerDavid S. Miller <davem@davemloft.net>2010-04-02 03:38:32 +0200
commit07e7de8f7a7146b3ac77c52ebd91c93a8370d9a8 (patch)
treef8236d971e13a2afd5178137ba778deb4b8989a7 /drivers/net/acenic.c
parentnet-caif: using kmalloc/kfree requires the include of slab.h (diff)
downloadlinux-07e7de8f7a7146b3ac77c52ebd91c93a8370d9a8.tar.xz
linux-07e7de8f7a7146b3ac77c52ebd91c93a8370d9a8.zip
acenic: fix the misusage of zero dma address
acenic wrongly assumes that zero is an invalid dma address (calls dma_unmap_page for only non zero dma addresses). Zero is a valid dma address on some architectures. The dma length can be used here. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/acenic.c')
-rw-r--r--drivers/net/acenic.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 4ae750ef1e10..e52cc3b71693 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2077,18 +2077,16 @@ static inline void ace_tx_int(struct net_device *dev,
do {
struct sk_buff *skb;
- dma_addr_t mapping;
struct tx_ring_info *info;
info = ap->skb->tx_skbuff + idx;
skb = info->skb;
- mapping = pci_unmap_addr(info, mapping);
- if (mapping) {
- pci_unmap_page(ap->pdev, mapping,
+ if (dma_unmap_len(info, maplen)) {
+ pci_unmap_page(ap->pdev, dma_unmap_addr(info, mapping),
pci_unmap_len(info, maplen),
PCI_DMA_TODEVICE);
- pci_unmap_addr_set(info, mapping, 0);
+ dma_unmap_len_set(info, maplen, 0);
}
if (skb) {
@@ -2376,14 +2374,12 @@ static int ace_close(struct net_device *dev)
for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) {
struct sk_buff *skb;
- dma_addr_t mapping;
struct tx_ring_info *info;
info = ap->skb->tx_skbuff + i;
skb = info->skb;
- mapping = pci_unmap_addr(info, mapping);
- if (mapping) {
+ if (dma_unmap_len(info, maplen)) {
if (ACE_IS_TIGON_I(ap)) {
/* NB: TIGON_1 is special, tx_ring is in io space */
struct tx_desc __iomem *tx;
@@ -2394,10 +2390,10 @@ static int ace_close(struct net_device *dev)
} else
memset(ap->tx_ring + i, 0,
sizeof(struct tx_desc));
- pci_unmap_page(ap->pdev, mapping,
+ pci_unmap_page(ap->pdev, dma_unmap_addr(info, mapping),
pci_unmap_len(info, maplen),
PCI_DMA_TODEVICE);
- pci_unmap_addr_set(info, mapping, 0);
+ dma_unmap_len_set(info, maplen, 0);
}
if (skb) {
dev_kfree_skb(skb);