summaryrefslogtreecommitdiffstats
path: root/drivers/char/virtio_console.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-09-02 18:11:41 +0530
committerRusty Russell <rusty@rustcorp.com.au>2010-10-21 17:43:59 +1030
commit96eb872b2a041b1536ccc6ae2fa87eb28f6e2bb2 (patch)
treed15cd8d2a0b0d9a5076eeb49735b0b9150e90676 /drivers/char/virtio_console.c
parent02238959944ce031f066f21e541a14933aca6575 (diff)
downloadlinux-96eb872b2a041b1536ccc6ae2fa87eb28f6e2bb2.tar.bz2
virtio: console: Remove control vq data only if using multiport support
If a portdev isn't using multiport support, it won't have any control vq data to remove. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r--drivers/char/virtio_console.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 076d0358cf0e..e15dbe72edbf 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1600,8 +1600,6 @@ static void virtcons_remove(struct virtio_device *vdev)
{
struct ports_device *portdev;
struct port *port, *port2;
- struct port_buffer *buf;
- unsigned int len;
portdev = vdev->priv;
@@ -1615,11 +1613,16 @@ static void virtcons_remove(struct virtio_device *vdev)
unregister_chrdev(portdev->chr_major, "virtio-portsdev");
- while ((buf = virtqueue_get_buf(portdev->c_ivq, &len)))
- free_buf(buf);
+ if (use_multiport(portdev)) {
+ struct port_buffer *buf;
+ unsigned int len;
- while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq)))
- free_buf(buf);
+ while ((buf = virtqueue_get_buf(portdev->c_ivq, &len)))
+ free_buf(buf);
+
+ while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq)))
+ free_buf(buf);
+ }
vdev->config->del_vqs(vdev);
kfree(portdev->in_vqs);