Commit 07e7de8f authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by David S. Miller

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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6c579906
...@@ -2077,18 +2077,16 @@ static inline void ace_tx_int(struct net_device *dev, ...@@ -2077,18 +2077,16 @@ static inline void ace_tx_int(struct net_device *dev,
do { do {
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t mapping;
struct tx_ring_info *info; struct tx_ring_info *info;
info = ap->skb->tx_skbuff + idx; info = ap->skb->tx_skbuff + idx;
skb = info->skb; skb = info->skb;
mapping = pci_unmap_addr(info, mapping);
if (mapping) { if (dma_unmap_len(info, maplen)) {
pci_unmap_page(ap->pdev, mapping, pci_unmap_page(ap->pdev, dma_unmap_addr(info, mapping),
pci_unmap_len(info, maplen), pci_unmap_len(info, maplen),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
pci_unmap_addr_set(info, mapping, 0); dma_unmap_len_set(info, maplen, 0);
} }
if (skb) { if (skb) {
...@@ -2376,14 +2374,12 @@ static int ace_close(struct net_device *dev) ...@@ -2376,14 +2374,12 @@ static int ace_close(struct net_device *dev)
for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) { for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) {
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t mapping;
struct tx_ring_info *info; struct tx_ring_info *info;
info = ap->skb->tx_skbuff + i; info = ap->skb->tx_skbuff + i;
skb = info->skb; skb = info->skb;
mapping = pci_unmap_addr(info, mapping);
if (mapping) { if (dma_unmap_len(info, maplen)) {
if (ACE_IS_TIGON_I(ap)) { if (ACE_IS_TIGON_I(ap)) {
/* NB: TIGON_1 is special, tx_ring is in io space */ /* NB: TIGON_1 is special, tx_ring is in io space */
struct tx_desc __iomem *tx; struct tx_desc __iomem *tx;
...@@ -2394,10 +2390,10 @@ static int ace_close(struct net_device *dev) ...@@ -2394,10 +2390,10 @@ static int ace_close(struct net_device *dev)
} else } else
memset(ap->tx_ring + i, 0, memset(ap->tx_ring + i, 0,
sizeof(struct tx_desc)); 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_unmap_len(info, maplen),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
pci_unmap_addr_set(info, mapping, 0); dma_unmap_len_set(info, maplen, 0);
} }
if (skb) { if (skb) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
......
Markdown is supported
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