public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/usb/serial/ark3116.c: fix check-after-use
@ 2007-08-14 21:22 Adrian Bunk
  0 siblings, 0 replies; only message in thread
From: Adrian Bunk @ 2007-08-14 21:22 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb-devel, linux-kernel

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>

---
--- 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;
 	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-14 21:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-14 21:22 [2.6 patch] drivers/usb/serial/ark3116.c: fix check-after-use Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox