From: Amit Shah Date: Thu, 2 Sep 2010 12:41:41 +0000 (+0530) Subject: virtio: console: Remove control vq data only if using multiport support X-Git-Tag: v2.6.37-rc1~219^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96eb872b2a041b1536ccc6ae2fa87eb28f6e2bb2;p=profile%2Fivi%2Fkernel-x86-ivi.git 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 Signed-off-by: Rusty Russell --- diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 076d035..e15dbe7 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);