if (awacs_rx_cmd_space) kfree(awacs_rx_cmd_space); 
kfree(awacs_rx_cmd_space); 
static int PMacReadSqSetup(void){	int i, count = 600;	volatile struct dbdma_cmd *cp;	LOCK();		/* stop the controller from doing any input - if it isn't already.	   it _should_ be before this is called anyway */		out_le32(&awacs_rxdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);	while ((in_le32(&awacs_rxdma->status) & RUN) && count--)		udelay(1);#ifdef DEBUG_DMASOUNDif (count <= 0)	printk("dmasound_pmac: read sq setup: timeout waiting for dma to stop\n");#endif	if ((read_sq.max_count+1) > number_of_rx_cmd_buffers ) {		if (awacs_rx_cmd_space)			kfree(awacs_rx_cmd_space);		number_of_rx_cmd_buffers = 0;		/* we need nbufs + 1 (for the loop) and we should request + 1 again		   because the DBDMA_ALIGN might pull the start up by up to		   sizeof(struct dbdma_cmd) - 4 (assuming kmalloc aligns 32 bits).		*/		awacs_rx_cmd_space = kmalloc			((read_sq.max_count + 1 + 1) * sizeof(struct dbdma_cmd),			 GFP_KERNEL);		if (awacs_rx_cmd_space == NULL) {			/* don't leave it dangling - nasty but better than a			   random address */			out_le32(&awacs_rxdma->cmdptr, virt_to_bus(beep_dbdma_cmd));			printk(KERN_ERR			   "dmasound_pmac: can't allocate dbdma cmd buffers"			   ", driver disabled\n");			UNLOCK();			return -ENOMEM;		}		awacs_rx_cmds = (volatile struct dbdma_cmd *)			DBDMA_ALIGN(awacs_rx_cmd_space);		number_of_rx_cmd_buffers = read_sq.max_count + 1 ;	}	cp = awacs_rx_cmds;	memset((void *)cp, 0, (read_sq.max_count+1) * sizeof(struct dbdma_cmd));	/* Set dma buffers up in a loop */	for (i = 0; i < read_sq.max_count; i++,cp++) {		st_le32(&cp->phy_addr, virt_to_bus(read_sq.buffers[i]));		st_le16(&cp->command, INPUT_MORE + INTR_ALWAYS);		st_le16(&cp->req_count, read_sq.block_size);		st_le16(&cp->xfer_status, 0);	}	/* The next two lines make the thing loop around.	*/	st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS);	st_le32(&cp->cmd_dep, virt_to_bus(awacs_rx_cmds));	/* point the controller at the command stack - ready to go */	out_le32(&awacs_rxdma->cmdptr, virt_to_bus(awacs_rx_cmds));	UNLOCK();	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/09417379be9b126e10ae7dcd7afc20b666146266/dmasound_awacs.c/clean/sound/oss/dmasound/dmasound_awacs.c