diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/virtio_console.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 490393186338..84b164d1eb2b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -388,6 +388,10 @@ static void discard_port_data(struct port *port) | |||
388 | unsigned int len; | 388 | unsigned int len; |
389 | int ret; | 389 | int ret; |
390 | 390 | ||
391 | if (!port->portdev) { | ||
392 | /* Device has been unplugged. vqs are already gone. */ | ||
393 | return; | ||
394 | } | ||
391 | vq = port->in_vq; | 395 | vq = port->in_vq; |
392 | if (port->inbuf) | 396 | if (port->inbuf) |
393 | buf = port->inbuf; | 397 | buf = port->inbuf; |
@@ -470,6 +474,10 @@ static void reclaim_consumed_buffers(struct port *port) | |||
470 | void *buf; | 474 | void *buf; |
471 | unsigned int len; | 475 | unsigned int len; |
472 | 476 | ||
477 | if (!port->portdev) { | ||
478 | /* Device has been unplugged. vqs are already gone. */ | ||
479 | return; | ||
480 | } | ||
473 | while ((buf = virtqueue_get_buf(port->out_vq, &len))) { | 481 | while ((buf = virtqueue_get_buf(port->out_vq, &len))) { |
474 | kfree(buf); | 482 | kfree(buf); |
475 | port->outvq_full = false; | 483 | port->outvq_full = false; |