kfree(mac_control->rings[i].ba[j]); 
kfree(mac_control->rings[i].ba); 
static void free_shared_mem(struct s2io_nic *nic){	int i, j, blk_cnt, size;	void *tmp_v_addr;	dma_addr_t tmp_p_addr;	mac_info_t *mac_control;	struct config_param *config;	int lst_size, lst_per_page;	struct net_device *dev = nic->dev;	if (!nic)		return;	mac_control = &nic->mac_control;	config = &nic->config;	lst_size = (sizeof(TxD_t) * config->max_txds);	lst_per_page = PAGE_SIZE / lst_size;	for (i = 0; i < config->tx_fifo_num; i++) {		int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,						lst_per_page);		for (j = 0; j < page_num; j++) {			int mem_blks = (j * lst_per_page);			if (!mac_control->fifos[i].list_info)				return;				if (!mac_control->fifos[i].list_info[mem_blks].				 list_virt_addr)				break;			pci_free_consistent(nic->pdev, PAGE_SIZE,					    mac_control->fifos[i].					    list_info[mem_blks].					    list_virt_addr,					    mac_control->fifos[i].					    list_info[mem_blks].					    list_phy_addr);		}		/* If we got a zero DMA address during allocation,		 * free the page now		 */		if (mac_control->zerodma_virt_addr) {			pci_free_consistent(nic->pdev, PAGE_SIZE,					    mac_control->zerodma_virt_addr,					    (dma_addr_t)0);			DBG_PRINT(INIT_DBG, 			  	"%s: Freeing TxDL with zero DMA addr. ",				dev->name);			DBG_PRINT(INIT_DBG, "Virtual address %p\n",				mac_control->zerodma_virt_addr);		}		kfree(mac_control->fifos[i].list_info);	}#ifndef CONFIG_2BUFF_MODE	size = (MAX_RXDS_PER_BLOCK + 1) * (sizeof(RxD_t));#else	size = SIZE_OF_BLOCK;#endif	for (i = 0; i < config->rx_ring_num; i++) {		blk_cnt = mac_control->rings[i].block_count;		for (j = 0; j < blk_cnt; j++) {			tmp_v_addr = mac_control->rings[i].rx_blocks[j].				block_virt_addr;			tmp_p_addr = mac_control->rings[i].rx_blocks[j].				block_dma_addr;			if (tmp_v_addr == NULL)				break;			pci_free_consistent(nic->pdev, size,					    tmp_v_addr, tmp_p_addr);		}	}#ifdef CONFIG_2BUFF_MODE	/* Freeing buffer storage addresses in 2BUFF mode. */	for (i = 0; i < config->rx_ring_num; i++) {		blk_cnt =		    config->rx_cfg[i].num_rxd / (MAX_RXDS_PER_BLOCK + 1);		for (j = 0; j < blk_cnt; j++) {			int k = 0;			if (!mac_control->rings[i].ba[j])				continue;			while (k != MAX_RXDS_PER_BLOCK) {				buffAdd_t *ba = &mac_control->rings[i].ba[j][k];				kfree(ba->ba_0_org);				kfree(ba->ba_1_org);				k++;			}			kfree(mac_control->rings[i].ba[j]);		}		kfree(mac_control->rings[i].ba);	}#endif	if (mac_control->stats_mem) {		pci_free_consistent(nic->pdev,				    mac_control->stats_mem_sz,				    mac_control->stats_mem,				    mac_control->stats_mem_phy);	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/da6971d8ece2ec9762509e20dda6808335b5a10b/s2io.c/clean/drivers/net/s2io.c