Patchwork [10/16] virtio-pci: check that event notification worked

login
register
mail settings
Submitter Zhiyong Wu
Date April 19, 2012, 2:39 a.m.
Message ID <1334803149-27379-11-git-send-email-zwu.kernel@gmail.com>
Download mbox | patch
Permalink /patch/153638/
State New
Headers show

Comments

Zhiyong Wu - April 19, 2012, 2:39 a.m.
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

For sanity assert that event notification succeeds.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 hw/virtio-pci.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index dcd58d0..025a518 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -293,8 +293,11 @@  static void virtio_pci_queue_notify(VirtIOPCIProxy *proxy, uint32_t n)
     vq = virtio_get_queue(proxy->vdev, n);
     notifier = virtio_queue_get_host_notifier(vq);
     if (event_notifier_valid(notifier)) {
+        int r;
+
         printf("notifying vq %u host notifier from userspace\n", n);
-        event_notifier_notify(notifier);
+        r = event_notifier_notify(notifier);
+        assert(r == 0);
     } else {
         virtio_queue_notify_vq(vq);
     }