Commit 96eb872b authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell

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: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 02238959
...@@ -1600,8 +1600,6 @@ static void virtcons_remove(struct virtio_device *vdev) ...@@ -1600,8 +1600,6 @@ static void virtcons_remove(struct virtio_device *vdev)
{ {
struct ports_device *portdev; struct ports_device *portdev;
struct port *port, *port2; struct port *port, *port2;
struct port_buffer *buf;
unsigned int len;
portdev = vdev->priv; portdev = vdev->priv;
...@@ -1615,11 +1613,16 @@ static void virtcons_remove(struct virtio_device *vdev) ...@@ -1615,11 +1613,16 @@ static void virtcons_remove(struct virtio_device *vdev)
unregister_chrdev(portdev->chr_major, "virtio-portsdev"); unregister_chrdev(portdev->chr_major, "virtio-portsdev");
while ((buf = virtqueue_get_buf(portdev->c_ivq, &len))) if (use_multiport(portdev)) {
free_buf(buf); struct port_buffer *buf;
unsigned int len;
while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq))) while ((buf = virtqueue_get_buf(portdev->c_ivq, &len)))
free_buf(buf); free_buf(buf);
while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq)))
free_buf(buf);
}
vdev->config->del_vqs(vdev); vdev->config->del_vqs(vdev);
kfree(portdev->in_vqs); kfree(portdev->in_vqs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment