[2.6 patch] usb/serial/io_ti.c: remove unneeded NULL check

From: Adrian Bunk
Date: Fri Feb 22 2008 - 15:03:56 EST


On Fri, Feb 22, 2008 at 10:10:16AM +0000, Alan Cox wrote:
> > Either the test of port->tty here is unneeded:
> >
> > if (port->tty)
> > port->tty->low_latency = low_latency;
> >
> > ...or the lack of test of port->tty here is a mistake:
> >
> > edge_set_termios (port, port->tty->termios);
>
> Interesting - so coverity doesn't understand the BKL. It's producing the
> right answer, for the right reason but the assumption it makes isn't 100%
> safe.

Coverity doesn't perform magic.
It simply notices that it's once checked and once dereferenced
unconditionally.

> The check can go.

Thanks, patch below.

> Alan

cu
Adrian


<-- snip -->


There's no reason for checking pdev->bus for being NULL here (and we'd
anyway Oops below if it was).

Signed-off-by: Adrian Bunk <bunk@xxxxxxxxxx>

---
afefd6935c788b3e4071092ebc04c4d356dd7496 diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index cd34059..700683c 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1944,8 +1944,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
if (edge_port == NULL)
return -ENODEV;

- if (port->tty)
- port->tty->low_latency = low_latency;
+ port->tty->low_latency = low_latency;

port_number = port->number - port->serial->minor;
switch (port_number) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/