[2.6 patch] ark3116.c: fix check-after-use

Previous thread: Disabling endpoints by Alan Stern on Monday, August 27, 2007 - 2:10 pm. (1 message)

Next thread: Regular Formatting problem with WINDOWS XP. by praveen koduru on Tuesday, August 28, 2007 - 11:52 pm. (2 messages)
From: Adrian Bunk
Date: Monday, August 27, 2007 - 2:29 pm

The Coverity checker spotted that we'd have already oops'ed if one of 
these was NULL.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

This patch has been sent on:
- 14 Aug 2007

--- linux-2.6.23-rc1-mm2/drivers/usb/serial/ark3116.c.old	2007-08-08 15:00:03.000000000 +0200
+++ linux-2.6.23-rc1-mm2/drivers/usb/serial/ark3116.c	2007-08-08 15:00:24.000000000 +0200
@@ -159,37 +159,32 @@
 static void ark3116_set_termios(struct usb_serial_port *port,
 				struct ktermios *old_termios)
 {
 	struct usb_serial *serial = port->serial;
 	struct ark3116_private *priv = usb_get_serial_port_data(port);
 	unsigned int cflag = port->tty->termios->c_cflag;
 	unsigned long flags;
 	int baud;
 	int ark3116_baud;
 	char *buf;
 	char config;
 
 	config = 0;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (!port->tty || !port->tty->termios) {
-		dbg("%s - no tty structures", __FUNCTION__);
-		return;
-	}
-
 	spin_lock_irqsave(&priv->lock, flags);
 	if (!priv->termios_initialized) {
 		*(port->tty->termios) = tty_std_termios;
 		port->tty->termios->c_cflag = B9600 | CS8
 					      | CREAD | HUPCL | CLOCAL;
 		priv->termios_initialized = 1;
 	}
 	spin_unlock_irqrestore(&priv->lock, flags);
 
 	cflag = port->tty->termios->c_cflag;
 
 	buf = kmalloc(1, GFP_KERNEL);
 	if (!buf) {
 		dbg("error kmalloc");
 		return;
 	}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Previous thread: Disabling endpoints by Alan Stern on Monday, August 27, 2007 - 2:10 pm. (1 message)

Next thread: Regular Formatting problem with WINDOWS XP. by praveen koduru on Tuesday, August 28, 2007 - 11:52 pm. (2 messages)