if (cpc_tty->buf_tx) { kfree(cpc_tty->buf_tx); cpc_tty->buf_tx = NULL; } 
kfree(cpc_tty->buf_tx); cpc_tty->buf_tx = NULL; 
static void cpc_tty_close(struct tty_struct *tty, struct file *flip){	st_cpc_tty_area    *cpc_tty;	unsigned long flags;	int res;	if (!tty || !tty->driver_data ) {		CPC_TTY_DBG("hdlx-tty: no TTY in close \n");		return;	}	cpc_tty = (st_cpc_tty_area *) tty->driver_data;	if ((cpc_tty->tty != tty)|| (cpc_tty->state != CPC_TTY_ST_OPEN)) {		CPC_TTY_DBG("%s: TTY is not opened\n",cpc_tty->name);		return;	}   		if (!cpc_tty->num_open) {		CPC_TTY_DBG("%s: TTY is closed\n",cpc_tty->name);		return;	}	if (--cpc_tty->num_open > 0) {		CPC_TTY_DBG("%s: TTY closed\n",cpc_tty->name);		return;	}	cpc_tty_signal_off(cpc_tty->pc300dev, CTL_DTR);	CPC_TTY_LOCK(cpc_tty->pc300dev->chan->card, flags);  /* lock irq */ 	cpc_tty->tty = NULL;	cpc_tty->state = CPC_TTY_ST_INIT;	CPC_TTY_UNLOCK(cpc_tty->pc300dev->chan->card, flags); /* unlock irq */ 		if (cpc_tty->buf_rx.first) {		unsigned char * aux;		while (cpc_tty->buf_rx.first) {			aux = (unsigned char *)cpc_tty->buf_rx.first;			cpc_tty->buf_rx.first = cpc_tty->buf_rx.first->next;			kfree(aux);		}		cpc_tty->buf_rx.first = NULL;		cpc_tty->buf_rx.last = NULL;	}		if (cpc_tty->buf_tx) {		kfree(cpc_tty->buf_tx);		cpc_tty->buf_tx = NULL;	}	CPC_TTY_DBG("%s: TTY closed\n",cpc_tty->name);		if (!serial_drv.refcount && cpc_tty_unreg_flag) {		cpc_tty_unreg_flag = 0;		CPC_TTY_DBG("%s: unregister the tty driver\n", cpc_tty->name);		if ((res=tty_unregister_driver(&serial_drv))) { 			CPC_TTY_DBG("%s: ERROR ->unregister the tty driver error=%d\n",							cpc_tty->name,res);		}	}	return; } 
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/6a5d362120a61a719095443194cc2d5e9a7027dd/pc300_tty.c/clean/drivers/net/wan/pc300_tty.c