aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/sis190.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 4487b065ef72..80af4a44580e 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -484,18 +484,24 @@ static struct sk_buff *sis190_alloc_rx_skb(struct sis190_private *tp,
484{ 484{
485 u32 rx_buf_sz = tp->rx_buf_sz; 485 u32 rx_buf_sz = tp->rx_buf_sz;
486 struct sk_buff *skb; 486 struct sk_buff *skb;
487 dma_addr_t mapping;
487 488
488 skb = netdev_alloc_skb(tp->dev, rx_buf_sz); 489 skb = netdev_alloc_skb(tp->dev, rx_buf_sz);
489 if (likely(skb)) { 490 if (unlikely(!skb))
490 dma_addr_t mapping; 491 goto skb_alloc_failed;
491 492 mapping = pci_map_single(tp->pci_dev, skb->data, tp->rx_buf_sz,
492 mapping = pci_map_single(tp->pci_dev, skb->data, tp->rx_buf_sz, 493 PCI_DMA_FROMDEVICE);
493 PCI_DMA_FROMDEVICE); 494 if (pci_dma_mapping_error(tp->pci_dev, mapping))
494 sis190_map_to_asic(desc, mapping, rx_buf_sz); 495 goto out;
495 } else 496 sis190_map_to_asic(desc, mapping, rx_buf_sz);
496 sis190_make_unusable_by_asic(desc);
497 497
498 return skb; 498 return skb;
499
500out:
501 dev_kfree_skb_any(skb);
502skb_alloc_failed:
503 sis190_make_unusable_by_asic(desc);
504 return NULL;
499} 505}
500 506
501static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, 507static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev,
@@ -1184,6 +1190,11 @@ static netdev_tx_t sis190_start_xmit(struct sk_buff *skb,
1184 } 1190 }
1185 1191
1186 mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); 1192 mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE);
1193 if (pci_dma_mapping_error(tp->pci_dev, mapping)) {
1194 netif_err(tp, tx_err, dev,
1195 "PCI mapping failed, dropping packet");
1196 return NETDEV_TX_BUSY;
1197 }
1187 1198
1188 tp->Tx_skbuff[entry] = skb; 1199 tp->Tx_skbuff[entry] = skb;
1189 1200