]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
virtio: console: Remove control vq data only if using multiport support
authorAmit Shah <amit.shah@redhat.com>
Thu, 2 Sep 2010 12:41:41 +0000 (18:11 +0530)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 21 Oct 2010 07:13:59 +0000 (17:43 +1030)
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>
drivers/char/virtio_console.c

index 076d0358cf0e558a9de4acd3d1f98f216000b0cb..e15dbe72edbffb1fa751b795f617e8f18a6c6145 100644 (file)
@@ -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);