aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorBorislav Petkov <bbpetkov@yahoo.de>2007-11-14 20:00:39 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-14 21:45:44 -0500
commit7eea436433b7b18045f272562e256976f593f7c0 (patch)
treef1477e08d43358f53e6c84a4bc6c9baa41f9731f /drivers/usb/serial
parent5bfeca3138a6031e38c566d57128ff592eb009a8 (diff)
keyspan: init termios properly
Remove redundant code leading to NULL ptr deref and let terminal config settings take place in the proper initialization path in usb_console_setup(). Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Cc: <lucy@keyspan.com> Cc: Greg KH <greg@kroah.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/keyspan.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 6bfdba6a213f..1f7ab15df36d 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1215,20 +1215,18 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port)
1215 1215
1216static int keyspan_open (struct usb_serial_port *port, struct file *filp) 1216static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1217{ 1217{
1218 struct keyspan_port_private *p_priv; 1218 struct keyspan_port_private *p_priv;
1219 struct keyspan_serial_private *s_priv; 1219 struct keyspan_serial_private *s_priv;
1220 struct usb_serial *serial = port->serial; 1220 struct usb_serial *serial = port->serial;
1221 const struct keyspan_device_details *d_details; 1221 const struct keyspan_device_details *d_details;
1222 int i, err; 1222 int i, err;
1223 int baud_rate, device_port;
1224 struct urb *urb; 1223 struct urb *urb;
1225 unsigned int cflag;
1226 1224
1227 s_priv = usb_get_serial_data(serial); 1225 s_priv = usb_get_serial_data(serial);
1228 p_priv = usb_get_serial_port_data(port); 1226 p_priv = usb_get_serial_port_data(port);
1229 d_details = p_priv->device_details; 1227 d_details = p_priv->device_details;
1230 1228
1231 dbg("%s - port%d.", __FUNCTION__, port->number); 1229 dbg("%s - port%d.", __FUNCTION__, port->number);
1232 1230
1233 /* Set some sane defaults */ 1231 /* Set some sane defaults */
1234 p_priv->rts_state = 1; 1232 p_priv->rts_state = 1;
@@ -1249,7 +1247,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1249 urb->dev = serial->dev; 1247 urb->dev = serial->dev;
1250 1248
1251 /* make sure endpoint data toggle is synchronized with the device */ 1249 /* make sure endpoint data toggle is synchronized with the device */
1252 1250
1253 usb_clear_halt(urb->dev, urb->pipe); 1251 usb_clear_halt(urb->dev, urb->pipe);
1254 1252
1255 if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { 1253 if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
@@ -1265,30 +1263,6 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1265 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ 1263 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */
1266 } 1264 }
1267 1265
1268 /* get the terminal config for the setup message now so we don't
1269 * need to send 2 of them */
1270
1271 cflag = port->tty->termios->c_cflag;
1272 device_port = port->number - port->serial->minor;
1273
1274 /* Baud rate calculation takes baud rate as an integer
1275 so other rates can be generated if desired. */
1276 baud_rate = tty_get_baud_rate(port->tty);
1277 /* If no match or invalid, leave as default */
1278 if (baud_rate >= 0
1279 && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
1280 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
1281 p_priv->baud = baud_rate;
1282 }
1283
1284 /* set CTS/RTS handshake etc. */
1285 p_priv->cflag = cflag;
1286 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
1287
1288 keyspan_send_setup(port, 1);
1289 //mdelay(100);
1290 //keyspan_set_termios(port, NULL);
1291
1292 return (0); 1266 return (0);
1293} 1267}
1294 1268