summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/natsemi/natsemi.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-12-31 18:20:10 -0500
committerDavid S. Miller <davem@davemloft.net>2015-12-31 18:20:10 -0500
commitc07f30ad68053181b3e8a0e65b0630e12e844f91 (patch)
tree8758968aabc844c435ff2a5d7d02c835fccd02a3 /drivers/net/ethernet/natsemi/natsemi.c
parent7b22a7788b0263f42f7232c5c05c503424ffa0ba (diff)
parent9c982e86dbdbaa3fb248dfc776dddda32cbc8927 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net/ethernet/natsemi/natsemi.c')
-rw-r--r--drivers/net/ethernet/natsemi/natsemi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c
index b83f7c0fcf99..122c2ee3dfe2 100644
--- a/drivers/net/ethernet/natsemi/natsemi.c
+++ b/drivers/net/ethernet/natsemi/natsemi.c
@@ -1937,6 +1937,12 @@ static void refill_rx(struct net_device *dev)
break; /* Better luck next round. */
np->rx_dma[entry] = pci_map_single(np->pci_dev,
skb->data, buflen, PCI_DMA_FROMDEVICE);
+ if (pci_dma_mapping_error(np->pci_dev,
+ np->rx_dma[entry])) {
+ dev_kfree_skb_any(skb);
+ np->rx_skbuff[entry] = NULL;
+ break; /* Better luck next round. */
+ }
np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]);
}
np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz);
@@ -2093,6 +2099,12 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
np->tx_skbuff[entry] = skb;
np->tx_dma[entry] = pci_map_single(np->pci_dev,
skb->data,skb->len, PCI_DMA_TODEVICE);
+ if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) {
+ np->tx_skbuff[entry] = NULL;
+ dev_kfree_skb_irq(skb);
+ dev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
+ }
np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]);