Skip to content

Commit

Permalink
virtio: console: Remove control vq data only if using multiport support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amit Shah authored and Rusty Russell committed Oct 21, 2010
1 parent 0223895 commit 96eb872
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit 96eb872

Please sign in to comment.