summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2009-10-07 22:05:06 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-10-10 00:52:05 +0400
commite63e278b4d2d867893962d3c7cd13a3a24ceb3f1 (patch)
tree356dffc7b4eb65e7052e58aabf523363e37867c1 /drivers/usb
parent63b0061246b54b849da8f189ae048e8110d8ce7d (diff)
downloadlinux-e63e278b4d2d867893962d3c7cd13a3a24ceb3f1.tar.xz
USB: ftdi_sio: clean up read completion handler
Remove superfluous error checks in completion handler: - No need to check private data and urb pointers as we check urb-status before dereferencing priv (which is not freed until urb has been killed on close). - No need to check tty as it is checked again when processing. - No need to check urb->number_of_packets on bulk urb. Note that both private data and tty are checked again before processing (possibly from work queue which also is cancelled on close). Signed-off-by: Johan Hovold <jhovold@gmail.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/ftdi_sio.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index bfb23d64bc6a..75c84d9b080d 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2008,39 +2008,14 @@ static int ftdi_chars_in_buffer(struct tty_struct *tty)
static void ftdi_read_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
- struct tty_struct *tty;
struct ftdi_private *priv;
int status = urb->status;
- if (urb->number_of_packets > 0) {
- dev_err(&port->dev, "%s transfer_buffer_length %d "
- "actual_length %d number of packets %d\n", __func__,
- urb->transfer_buffer_length,
- urb->actual_length, urb->number_of_packets);
- dev_err(&port->dev, "%s transfer_flags %x\n", __func__,
- urb->transfer_flags);
- }
-
dbg("%s - port %d", __func__, port->number);
if (port->port.count <= 0)
return;
- tty = tty_port_tty_get(&port->port);
- if (!tty) {
- dbg("%s - bad tty pointer - exiting", __func__);
- return;
- }
-
- priv = usb_get_serial_port_data(port);
- if (!priv) {
- dbg("%s - bad port private data pointer - exiting", __func__);
- goto out;
- }
-
- if (urb != port->read_urb)
- dev_err(&port->dev, "%s - Not my urb!\n", __func__);
-
if (status) {
/* This will happen at close every time so it is a dbg not an
err */
@@ -2048,9 +2023,8 @@ static void ftdi_read_bulk_callback(struct urb *urb)
goto out;
}
+ priv = usb_get_serial_port_data(port);
ftdi_process_read(&priv->rx_work.work);
-out:
- tty_kref_put(tty);
} /* ftdi_read_bulk_callback */