summaryrefslogtreecommitdiffstats
path: root/drivers/net/jme.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-22 05:21:27 +0200
committerDavid S. Miller <davem@davemloft.net>2011-07-22 05:21:27 +0200
commite627539090d5a4efe1d55f1dfa24f8ce08a454e8 (patch)
tree0e35e6923397d1129ea1469c9153fa1f5a26d55d /drivers/net/jme.c
parentstmmac: improve and up-to-date the documentation (diff)
parentjme: Fix unmap error (Causing system freeze) (diff)
downloadlinux-e627539090d5a4efe1d55f1dfa24f8ce08a454e8.tar.xz
linux-e627539090d5a4efe1d55f1dfa24f8ce08a454e8.zip
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net/jme.c')
-rw-r--r--drivers/net/jme.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 85a11e0fa548..3ac262f55633 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -751,20 +751,28 @@ jme_make_new_rx_buf(struct jme_adapter *jme, int i)
struct jme_ring *rxring = &(jme->rxring[0]);
struct jme_buffer_info *rxbi = rxring->bufinf + i;
struct sk_buff *skb;
+ dma_addr_t mapping;
skb = netdev_alloc_skb(jme->dev,
jme->dev->mtu + RX_EXTRA_LEN);
if (unlikely(!skb))
return -ENOMEM;
+ mapping = pci_map_page(jme->pdev, virt_to_page(skb->data),
+ offset_in_page(skb->data), skb_tailroom(skb),
+ PCI_DMA_FROMDEVICE);
+ if (unlikely(pci_dma_mapping_error(jme->pdev, mapping))) {
+ dev_kfree_skb(skb);
+ return -ENOMEM;
+ }
+
+ if (likely(rxbi->mapping))
+ pci_unmap_page(jme->pdev, rxbi->mapping,
+ rxbi->len, PCI_DMA_FROMDEVICE);
+
rxbi->skb = skb;
rxbi->len = skb_tailroom(skb);
- rxbi->mapping = pci_map_page(jme->pdev,
- virt_to_page(skb->data),
- offset_in_page(skb->data),
- rxbi->len,
- PCI_DMA_FROMDEVICE);
-
+ rxbi->mapping = mapping;
return 0;
}