Commit ec3ee508 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: serial: clear fifo on close

Make sure fifo is emptied on close.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 50dbb852
...@@ -156,13 +156,19 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_open); ...@@ -156,13 +156,19 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_open);
static void generic_cleanup(struct usb_serial_port *port) static void generic_cleanup(struct usb_serial_port *port)
{ {
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
unsigned long flags;
dbg("%s - port %d", __func__, port->number); dbg("%s - port %d", __func__, port->number);
if (serial->dev) { if (serial->dev) {
/* shutdown any bulk transfers that might be going on */ /* 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); 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) if (port->bulk_in_size)
usb_kill_urb(port->read_urb); usb_kill_urb(port->read_urb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment