aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/console.c')
-rw-r--r--drivers/usb/serial/console.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 8d7fc48b1f30..29fa1c3d0089 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -46,6 +46,8 @@ static struct console usbcons;
46 * ------------------------------------------------------------ 46 * ------------------------------------------------------------
47 */ 47 */
48 48
49static const struct tty_operations usb_console_fake_tty_ops = {
50};
49 51
50/* 52/*
51 * The parsing of the command line works exactly like the 53 * The parsing of the command line works exactly like the
@@ -137,13 +139,17 @@ static int usb_console_setup(struct console *co, char *options)
137 goto reset_open_count; 139 goto reset_open_count;
138 } 140 }
139 kref_init(&tty->kref); 141 kref_init(&tty->kref);
140 tty_port_tty_set(&port->port, tty);
141 tty->driver = usb_serial_tty_driver; 142 tty->driver = usb_serial_tty_driver;
142 tty->index = co->index; 143 tty->index = co->index;
144 init_ldsem(&tty->ldisc_sem);
145 INIT_LIST_HEAD(&tty->tty_files);
146 kref_get(&tty->driver->kref);
147 tty->ops = &usb_console_fake_tty_ops;
143 if (tty_init_termios(tty)) { 148 if (tty_init_termios(tty)) {
144 retval = -ENOMEM; 149 retval = -ENOMEM;
145 goto free_tty; 150 goto put_tty;
146 } 151 }
152 tty_port_tty_set(&port->port, tty);
147 } 153 }
148 154
149 /* only call the device specific open if this 155 /* only call the device specific open if this
@@ -161,7 +167,7 @@ static int usb_console_setup(struct console *co, char *options)
161 serial->type->set_termios(tty, port, &dummy); 167 serial->type->set_termios(tty, port, &dummy);
162 168
163 tty_port_tty_set(&port->port, NULL); 169 tty_port_tty_set(&port->port, NULL);
164 kfree(tty); 170 tty_kref_put(tty);
165 } 171 }
166 set_bit(ASYNCB_INITIALIZED, &port->port.flags); 172 set_bit(ASYNCB_INITIALIZED, &port->port.flags);
167 } 173 }
@@ -177,8 +183,8 @@ static int usb_console_setup(struct console *co, char *options)
177 183
178 fail: 184 fail:
179 tty_port_tty_set(&port->port, NULL); 185 tty_port_tty_set(&port->port, NULL);
180 free_tty: 186 put_tty:
181 kfree(tty); 187 tty_kref_put(tty);
182 reset_open_count: 188 reset_open_count:
183 port->port.count = 0; 189 port->port.count = 0;
184 usb_autopm_put_interface(serial->interface); 190 usb_autopm_put_interface(serial->interface);