Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / drivers / usb / serial / safe_serial.c
index c949ce6..21cd7bf 100644 (file)
@@ -207,38 +207,31 @@ static void safe_process_read_urb(struct urb *urb)
        unsigned char *data = urb->transfer_buffer;
        unsigned char length = urb->actual_length;
        int actual_length;
-       struct tty_struct *tty;
        __u16 fcs;
 
        if (!length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        if (!safe)
                goto out;
 
        fcs = fcs_compute10(data, length, CRC10_INITFCS);
        if (fcs) {
                dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
-               goto err;
+               return;
        }
 
        actual_length = data[length - 2] >> 2;
        if (actual_length > (length - 2)) {
                dev_err(&port->dev, "%s - inconsistent lengths %d:%d\n",
                                __func__, actual_length, length);
-               goto err;
+               return;
        }
        dev_info(&urb->dev->dev, "%s - actual: %d\n", __func__, actual_length);
        length = actual_length;
 out:
-       tty_insert_flip_string(tty, data, length);
-       tty_flip_buffer_push(tty);
-err:
-       tty_kref_put(tty);
+       tty_insert_flip_string(&port->port, data, length);
+       tty_flip_buffer_push(&port->port);
 }
 
 static int safe_prepare_write_buffer(struct usb_serial_port *port,