diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-06-10 12:29:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-10 14:00:49 -0400 |
commit | 5e4211f1c47560c36a8b3d4544dfd866dcf7ccd0 (patch) | |
tree | 1d41c51b3481d7a602a41e4a8140965612b8f71d /drivers/usb/serial/spcp8x5.c | |
parent | 21886725d58e92188159731c7c1aac803dd6b9dc (diff) |
USB: spcp8x5: fix device initialisation at open
Do not use uninitialised termios data to determine when to configure the
device at open.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/spcp8x5.c')
-rw-r--r-- | drivers/usb/serial/spcp8x5.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index cf3df793c2b7..ddf6c47137dc 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -291,7 +291,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty, | |||
291 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); | 291 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); |
292 | unsigned long flags; | 292 | unsigned long flags; |
293 | unsigned int cflag = tty->termios.c_cflag; | 293 | unsigned int cflag = tty->termios.c_cflag; |
294 | unsigned int old_cflag = old_termios->c_cflag; | ||
295 | unsigned short uartdata; | 294 | unsigned short uartdata; |
296 | unsigned char buf[2] = {0, 0}; | 295 | unsigned char buf[2] = {0, 0}; |
297 | int baud; | 296 | int baud; |
@@ -299,15 +298,15 @@ static void spcp8x5_set_termios(struct tty_struct *tty, | |||
299 | u8 control; | 298 | u8 control; |
300 | 299 | ||
301 | /* check that they really want us to change something */ | 300 | /* check that they really want us to change something */ |
302 | if (!tty_termios_hw_change(&tty->termios, old_termios)) | 301 | if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) |
303 | return; | 302 | return; |
304 | 303 | ||
305 | /* set DTR/RTS active */ | 304 | /* set DTR/RTS active */ |
306 | spin_lock_irqsave(&priv->lock, flags); | 305 | spin_lock_irqsave(&priv->lock, flags); |
307 | control = priv->line_control; | 306 | control = priv->line_control; |
308 | if ((old_cflag & CBAUD) == B0) { | 307 | if (old_termios && (old_termios->c_cflag & CBAUD) == B0) { |
309 | priv->line_control |= MCR_DTR; | 308 | priv->line_control |= MCR_DTR; |
310 | if (!(old_cflag & CRTSCTS)) | 309 | if (!(old_termios->c_cflag & CRTSCTS)) |
311 | priv->line_control |= MCR_RTS; | 310 | priv->line_control |= MCR_RTS; |
312 | } | 311 | } |
313 | if (control != priv->line_control) { | 312 | if (control != priv->line_control) { |
@@ -394,7 +393,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty, | |||
394 | 393 | ||
395 | static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) | 394 | static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) |
396 | { | 395 | { |
397 | struct ktermios tmp_termios; | ||
398 | struct usb_serial *serial = port->serial; | 396 | struct usb_serial *serial = port->serial; |
399 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); | 397 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); |
400 | int ret; | 398 | int ret; |
@@ -411,7 +409,7 @@ static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
411 | spcp8x5_set_ctrl_line(port, priv->line_control); | 409 | spcp8x5_set_ctrl_line(port, priv->line_control); |
412 | 410 | ||
413 | if (tty) | 411 | if (tty) |
414 | spcp8x5_set_termios(tty, port, &tmp_termios); | 412 | spcp8x5_set_termios(tty, port, NULL); |
415 | 413 | ||
416 | port->port.drain_delay = 256; | 414 | port->port.drain_delay = 256; |
417 | 415 | ||