@@ -1261,7 +1261,6 @@ static void ftdi_shutdown (struct usb_serial *serial)
1261
1261
1262
1262
static int ftdi_open (struct usb_serial_port * port , struct file * filp )
1263
1263
{ /* ftdi_open */
1264
- struct termios tmp_termios ;
1265
1264
struct usb_device * dev = port -> serial -> dev ;
1266
1265
struct ftdi_private * priv = usb_get_serial_port_data (port );
1267
1266
unsigned long flags ;
@@ -1271,8 +1270,8 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1271
1270
1272
1271
dbg ("%s" , __FUNCTION__ );
1273
1272
1274
-
1275
- port -> tty -> low_latency = (priv -> flags & ASYNC_LOW_LATENCY ) ? 1 : 0 ;
1273
+ if ( port -> tty )
1274
+ port -> tty -> low_latency = (priv -> flags & ASYNC_LOW_LATENCY ) ? 1 : 0 ;
1276
1275
1277
1276
/* No error checking for this (will get errors later anyway) */
1278
1277
/* See ftdi_sio.h for description of what is reset */
@@ -1286,7 +1285,8 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1286
1285
This is same behaviour as serial.c/rs_open() - Kuba */
1287
1286
1288
1287
/* ftdi_set_termios will send usb control messages */
1289
- ftdi_set_termios (port , & tmp_termios );
1288
+ if (port -> tty )
1289
+ ftdi_set_termios (port , NULL );
1290
1290
1291
1291
/* FIXME: Flow control might be enabled, so it should be checked -
1292
1292
we have no control of defaults! */
@@ -1867,7 +1867,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1867
1867
err ("%s urb failed to set baudrate" , __FUNCTION__ );
1868
1868
}
1869
1869
/* Ensure RTS and DTR are raised when baudrate changed from 0 */
1870
- if ((old_termios -> c_cflag & CBAUD ) == B0 ) {
1870
+ if (! old_termios || (old_termios -> c_cflag & CBAUD ) == B0 ) {
1871
1871
set_mctrl (port , TIOCM_DTR | TIOCM_RTS );
1872
1872
}
1873
1873
}
0 commit comments