diff options
-rw-r--r-- | drivers/usb/gadget/serial.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index b35ac6d334f8..65e084a2c87e 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -890,10 +890,12 @@ static void gs_close(struct tty_struct *tty, struct file *file) | |||
890 | /* wait for write buffer to drain, or */ | 890 | /* wait for write buffer to drain, or */ |
891 | /* at most GS_CLOSE_TIMEOUT seconds */ | 891 | /* at most GS_CLOSE_TIMEOUT seconds */ |
892 | if (gs_buf_data_avail(port->port_write_buf) > 0) { | 892 | if (gs_buf_data_avail(port->port_write_buf) > 0) { |
893 | spin_unlock_irqrestore(&port->port_lock, flags); | ||
893 | wait_cond_interruptible_timeout(port->port_write_wait, | 894 | wait_cond_interruptible_timeout(port->port_write_wait, |
894 | port->port_dev == NULL | 895 | port->port_dev == NULL |
895 | || gs_buf_data_avail(port->port_write_buf) == 0, | 896 | || gs_buf_data_avail(port->port_write_buf) == 0, |
896 | &port->port_lock, flags, GS_CLOSE_TIMEOUT * HZ); | 897 | &port->port_lock, flags, GS_CLOSE_TIMEOUT * HZ); |
898 | spin_lock_irqsave(&port->port_lock, flags); | ||
897 | } | 899 | } |
898 | 900 | ||
899 | /* free disconnected port on final close */ | 901 | /* free disconnected port on final close */ |