diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c index 8e42a7682c63d8..d42972b2d2c400 100644 --- a/drivers/tty/serial/jsm/jsm_tty.c +++ b/drivers/tty/serial/jsm/jsm_tty.c @@ -195,38 +195,6 @@ static int jsm_tty_open(struct uart_port *port) /* Get board pointer from our array of majors we have allocated */ brd = channel->ch_bd; - /* - * Allocate channel buffers for read/write/error. - * Set flag, so we don't get trounced on. - */ - channel->ch_flags |= (CH_OPENING); - - /* Drop locks, as malloc with GFP_KERNEL can sleep */ - - if (!channel->ch_rqueue) { - channel->ch_rqueue = kzalloc(RQUEUESIZE, GFP_KERNEL); - if (!channel->ch_rqueue) { - jsm_dbg(INIT, &channel->ch_bd->pci_dev, - "unable to allocate read queue buf\n"); - return -ENOMEM; - } - } - if (!channel->ch_equeue) { - channel->ch_equeue = kzalloc(EQUEUESIZE, GFP_KERNEL); - if (!channel->ch_equeue) { - jsm_dbg(INIT, &channel->ch_bd->pci_dev, - "unable to allocate error queue buf\n"); - return -ENOMEM; - } - } - - channel->ch_flags &= ~(CH_OPENING); - /* - * Initialize if neither terminal is open. - */ - jsm_dbg(OPEN, &channel->ch_bd->pci_dev, - "jsm_open: initializing channel in open...\n"); - /* * Flush input queues. */ @@ -420,6 +388,17 @@ int jsm_tty_init(struct jsm_board *brd) ch->ch_close_delay = 250; init_waitqueue_head(&ch->ch_flags_wait); + + if (!ch->ch_rqueue) { + ch->ch_rqueue = kzalloc(RQUEUESIZE, GFP_KERNEL); + if (!ch->ch_rqueue) + return -ENOMEM; + } + if (!ch->ch_equeue) { + ch->ch_equeue = kzalloc(EQUEUESIZE, GFP_KERNEL); + if (!ch->ch_equeue) + return -ENOMEM; + } } jsm_dbg(INIT, &brd->pci_dev, "finish\n");