aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/u_serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/u_serial.c')
-rw-r--r--drivers/usb/gadget/u_serial.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 598dcc1212f0..46b1cc773ab8 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -495,12 +495,8 @@ static void gs_rx_push(unsigned long _port)
495 495
496 req = list_first_entry(queue, struct usb_request, list); 496 req = list_first_entry(queue, struct usb_request, list);
497 497
498 /* discard data if tty was closed */
499 if (!tty)
500 goto recycle;
501
502 /* leave data queued if tty was rx throttled */ 498 /* leave data queued if tty was rx throttled */
503 if (test_bit(TTY_THROTTLED, &tty->flags)) 499 if (tty && test_bit(TTY_THROTTLED, &tty->flags))
504 break; 500 break;
505 501
506 switch (req->status) { 502 switch (req->status) {
@@ -533,7 +529,8 @@ static void gs_rx_push(unsigned long _port)
533 size -= n; 529 size -= n;
534 } 530 }
535 531
536 count = tty_insert_flip_string(tty, packet, size); 532 count = tty_insert_flip_string(&port->port, packet,
533 size);
537 if (count) 534 if (count)
538 do_push = true; 535 do_push = true;
539 if (count != size) { 536 if (count != size) {
@@ -546,7 +543,7 @@ static void gs_rx_push(unsigned long _port)
546 } 543 }
547 port->n_read = 0; 544 port->n_read = 0;
548 } 545 }
549recycle: 546
550 list_move(&req->list, &port->read_pool); 547 list_move(&req->list, &port->read_pool);
551 port->read_started--; 548 port->read_started--;
552 } 549 }
@@ -554,8 +551,8 @@ recycle:
554 /* Push from tty to ldisc; without low_latency set this is handled by 551 /* Push from tty to ldisc; without low_latency set this is handled by
555 * a workqueue, so we won't get callbacks and can hold port_lock 552 * a workqueue, so we won't get callbacks and can hold port_lock
556 */ 553 */
557 if (tty && do_push) 554 if (do_push)
558 tty_flip_buffer_push(tty); 555 tty_flip_buffer_push(&port->port);
559 556
560 557
561 /* We want our data queue to become empty ASAP, keeping data 558 /* We want our data queue to become empty ASAP, keeping data