summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-05-20 04:15:47 (GMT)
committerRusty Russell <rusty@rustcorp.com.au>2010-05-19 12:45:47 (GMT)
commit6dc69f970231387d8fe646a831920da26408b5f5 (patch)
tree64596dafbf37893692493cfd0be247e7f0e24a80 /drivers/char
parenteaeff9608a8cf43a676b6f4b6235ea9d76192230 (diff)
downloadlinux-fsl-qoriq-6dc69f970231387d8fe646a831920da26408b5f5.tar.xz
virtio: console: Return -EPIPE to hvc_console if we lost the connection
hvc_console handles -EPIPE properly when the connection to the host is lost. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/virtio_console.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index f63bf77..11a9573 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)
port = find_port_by_vtermno(vtermno);
if (!port)
- return 0;
+ return -EPIPE;
return send_buf(port, (void *)buf, count);
}
@@ -669,9 +669,13 @@ static int get_chars(u32 vtermno, char *buf, int count)
{
struct port *port;
+ /* If we've not set up the port yet, we have no input to give. */
+ if (unlikely(early_put_chars))
+ return 0;
+
port = find_port_by_vtermno(vtermno);
if (!port)
- return 0;
+ return -EPIPE;
/* If we don't have an input queue yet, we can't get input. */
BUG_ON(!port->in_vq);