usb: fix sillies in the metro USB driver
authorAlan Cox <alan@linux.intel.com>
Thu, 12 Jul 2012 11:59:17 +0000 (12:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jul 2012 21:39:19 +0000 (14:39 -0700)
Bits noticed doing the termios conversion

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/metro-usb.c

index 81423f7361dbe8f770086c3a03f6aca09b4beb2c..bad5f0cb7ae89c95c23ebe1e91745680685f34d3 100644 (file)
@@ -130,20 +130,14 @@ static void metrousb_read_int_callback(struct urb *urb)
 
        /* Set the data read from the usb port into the serial port buffer. */
        tty = tty_port_tty_get(&port->port);
-       if (!tty) {
-               dev_err(&port->dev, "%s - bad tty pointer - exiting\n",
-                       __func__);
-               return;
-       }
-
        if (tty && urb->actual_length) {
                /* Loop through the data copying each byte to the tty layer. */
                tty_insert_flip_string(tty, data, urb->actual_length);
 
                /* Force the data to the tty layer. */
                tty_flip_buffer_push(tty);
+               tty_kref_put(tty);
        }
-       tty_kref_put(tty);
 
        /* Set any port variables. */
        spin_lock_irqsave(&metro_priv->lock, flags);