aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraghavendra.koushik@neterion.com <raghavendra.koushik@neterion.com>2005-08-03 15:30:43 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-11 00:10:44 -0400
commit1ddc50d40a19b3524d302d1d6bfd52ac7bc6b6f7 (patch)
treef97dc6eda470a52e1fbfb1a6dac52b79092752c7
parent7ba013ac029513eb4b70cfcd4b86e37c5f16c483 (diff)
[PATCH] S2io: Removed memory leaks
Hi, This patch fixes certain memory leaks discovered in free_tx_buffers() and rx_osm_handler() Signed-off-by: Ravinandan Arakali <ravinandan.arakali@neterion.com> Signed-off-by: Raghavendra Koushik <raghavendra.koushik@neterion.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/net/s2io.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index e24c5e544734..6668b99025c8 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1709,7 +1709,7 @@ static void free_tx_buffers(struct s2io_nic *nic)
1709 int i, j; 1709 int i, j;
1710 mac_info_t *mac_control; 1710 mac_info_t *mac_control;
1711 struct config_param *config; 1711 struct config_param *config;
1712 int cnt = 0; 1712 int cnt = 0, frg_cnt;
1713 1713
1714 mac_control = &nic->mac_control; 1714 mac_control = &nic->mac_control;
1715 config = &nic->config; 1715 config = &nic->config;
@@ -1722,11 +1722,33 @@ static void free_tx_buffers(struct s2io_nic *nic)
1722 (struct sk_buff *) ((unsigned long) txdp-> 1722 (struct sk_buff *) ((unsigned long) txdp->
1723 Host_Control); 1723 Host_Control);
1724 if (skb == NULL) { 1724 if (skb == NULL) {
1725 memset(txdp, 0, sizeof(TxD_t)); 1725 memset(txdp, 0, sizeof(TxD_t) *
1726 config->max_txds);
1726 continue; 1727 continue;
1727 } 1728 }
1729 frg_cnt = skb_shinfo(skb)->nr_frags;
1730 pci_unmap_single(nic->pdev, (dma_addr_t)
1731 txdp->Buffer_Pointer,
1732 skb->len - skb->data_len,
1733 PCI_DMA_TODEVICE);
1734 if (frg_cnt) {
1735 TxD_t *temp;
1736 temp = txdp;
1737 txdp++;
1738 for (j = 0; j < frg_cnt; j++, txdp++) {
1739 skb_frag_t *frag =
1740 &skb_shinfo(skb)->frags[j];
1741 pci_unmap_page(nic->pdev,
1742 (dma_addr_t)
1743 txdp->
1744 Buffer_Pointer,
1745 frag->size,
1746 PCI_DMA_TODEVICE);
1747 }
1748 txdp = temp;
1749 }
1728 dev_kfree_skb(skb); 1750 dev_kfree_skb(skb);
1729 memset(txdp, 0, sizeof(TxD_t)); 1751 memset(txdp, 0, sizeof(TxD_t) * config->max_txds);
1730 cnt++; 1752 cnt++;
1731 } 1753 }
1732 DBG_PRINT(INTR_DBG, 1754 DBG_PRINT(INTR_DBG,
@@ -4570,6 +4592,11 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp)
4570 unsigned long long err = rxdp->Control_1 & RXD_T_CODE; 4592 unsigned long long err = rxdp->Control_1 & RXD_T_CODE;
4571 DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%llx\n", 4593 DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%llx\n",
4572 dev->name, err); 4594 dev->name, err);
4595 dev_kfree_skb(skb);
4596 sp->stats.rx_crc_errors++;
4597 atomic_dec(&sp->rx_bufs_left[ring_no]);
4598 rxdp->Host_Control = 0;
4599 return 0;
4573 } 4600 }
4574 4601
4575 /* Updating statistics */ 4602 /* Updating statistics */