diff options
-rw-r--r-- | drivers/char/virtio_console.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index f63bf77a4825..11a9573f901e 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -653,7 +653,7 @@ static int put_chars(u32 vtermno, const char *buf, int count) | |||
653 | 653 | ||
654 | port = find_port_by_vtermno(vtermno); | 654 | port = find_port_by_vtermno(vtermno); |
655 | if (!port) | 655 | if (!port) |
656 | return 0; | 656 | return -EPIPE; |
657 | 657 | ||
658 | return send_buf(port, (void *)buf, count); | 658 | return send_buf(port, (void *)buf, count); |
659 | } | 659 | } |
@@ -669,9 +669,13 @@ static int get_chars(u32 vtermno, char *buf, int count) | |||
669 | { | 669 | { |
670 | struct port *port; | 670 | struct port *port; |
671 | 671 | ||
672 | /* If we've not set up the port yet, we have no input to give. */ | ||
673 | if (unlikely(early_put_chars)) | ||
674 | return 0; | ||
675 | |||
672 | port = find_port_by_vtermno(vtermno); | 676 | port = find_port_by_vtermno(vtermno); |
673 | if (!port) | 677 | if (!port) |
674 | return 0; | 678 | return -EPIPE; |
675 | 679 | ||
676 | /* If we don't have an input queue yet, we can't get input. */ | 680 | /* If we don't have an input queue yet, we can't get input. */ |
677 | BUG_ON(!port->in_vq); | 681 | BUG_ON(!port->in_vq); |