Skip to content

Commit

Permalink
USB: serial: clear fifo on close
Browse files Browse the repository at this point in the history
Make sure fifo is emptied on close.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed May 20, 2010
1 parent 50dbb85 commit ec3ee50
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/usb/serial/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,19 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_open);
static void generic_cleanup(struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
unsigned long flags;

dbg("%s - port %d", __func__, port->number);

if (serial->dev) {
/* shutdown any bulk transfers that might be going on */
if (port->bulk_out_size)
if (port->bulk_out_size) {
usb_kill_urb(port->write_urb);

spin_lock_irqsave(&port->lock, flags);
kfifo_reset_out(&port->write_fifo);
spin_unlock_irqrestore(&port->lock, flags);
}
if (port->bulk_in_size)
usb_kill_urb(port->read_urb);
}
Expand Down

0 comments on commit ec3ee50

Please sign in to comment.