diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-03-31 18:13:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-01 21:38:32 -0400 |
commit | 07e7de8f7a7146b3ac77c52ebd91c93a8370d9a8 (patch) | |
tree | f8236d971e13a2afd5178137ba778deb4b8989a7 /drivers/net/acenic.c | |
parent | 6c57990696a16ae43ea9fddb131b2784292068ba (diff) |
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.c | 16 |
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, | |||
2077 | 2077 | ||
2078 | do { | 2078 | do { |
2079 | struct sk_buff *skb; | 2079 | struct sk_buff *skb; |
2080 | dma_addr_t mapping; | ||
2081 | struct tx_ring_info *info; | 2080 | struct tx_ring_info *info; |
2082 | 2081 | ||
2083 | info = ap->skb->tx_skbuff + idx; | 2082 | info = ap->skb->tx_skbuff + idx; |
2084 | skb = info->skb; | 2083 | skb = info->skb; |
2085 | mapping = pci_unmap_addr(info, mapping); | ||
2086 | 2084 | ||
2087 | if (mapping) { | 2085 | if (dma_unmap_len(info, maplen)) { |
2088 | pci_unmap_page(ap->pdev, mapping, | 2086 | pci_unmap_page(ap->pdev, dma_unmap_addr(info, mapping), |
2089 | pci_unmap_len(info, maplen), | 2087 | pci_unmap_len(info, maplen), |
2090 | PCI_DMA_TODEVICE); | 2088 | PCI_DMA_TODEVICE); |
2091 | pci_unmap_addr_set(info, mapping, 0); | 2089 | dma_unmap_len_set(info, maplen, 0); |
2092 | } | 2090 | } |
2093 | 2091 | ||
2094 | if (skb) { | 2092 | if (skb) { |
@@ -2376,14 +2374,12 @@ static int ace_close(struct net_device *dev) | |||
2376 | 2374 | ||
2377 | for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) { | 2375 | for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) { |
2378 | struct sk_buff *skb; | 2376 | struct sk_buff *skb; |
2379 | dma_addr_t mapping; | ||
2380 | struct tx_ring_info *info; | 2377 | struct tx_ring_info *info; |
2381 | 2378 | ||
2382 | info = ap->skb->tx_skbuff + i; | 2379 | info = ap->skb->tx_skbuff + i; |
2383 | skb = info->skb; | 2380 | skb = info->skb; |
2384 | mapping = pci_unmap_addr(info, mapping); | ||
2385 | 2381 | ||
2386 | if (mapping) { | 2382 | if (dma_unmap_len(info, maplen)) { |
2387 | if (ACE_IS_TIGON_I(ap)) { | 2383 | if (ACE_IS_TIGON_I(ap)) { |
2388 | /* NB: TIGON_1 is special, tx_ring is in io space */ | 2384 | /* NB: TIGON_1 is special, tx_ring is in io space */ |
2389 | struct tx_desc __iomem *tx; | 2385 | struct tx_desc __iomem *tx; |
@@ -2394,10 +2390,10 @@ static int ace_close(struct net_device *dev) | |||
2394 | } else | 2390 | } else |
2395 | memset(ap->tx_ring + i, 0, | 2391 | memset(ap->tx_ring + i, 0, |
2396 | sizeof(struct tx_desc)); | 2392 | sizeof(struct tx_desc)); |
2397 | pci_unmap_page(ap->pdev, mapping, | 2393 | pci_unmap_page(ap->pdev, dma_unmap_addr(info, mapping), |
2398 | pci_unmap_len(info, maplen), | 2394 | pci_unmap_len(info, maplen), |
2399 | PCI_DMA_TODEVICE); | 2395 | PCI_DMA_TODEVICE); |
2400 | pci_unmap_addr_set(info, mapping, 0); | 2396 | dma_unmap_len_set(info, maplen, 0); |
2401 | } | 2397 | } |
2402 | if (skb) { | 2398 | if (skb) { |
2403 | dev_kfree_skb(skb); | 2399 | dev_kfree_skb(skb); |