qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Joel Stanley <joel@jms.id.au>,
	Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 3/5] virtio-net: remove function calls from assert
Date: Mon, 17 Feb 2014 16:25:40 +0200	[thread overview]
Message-ID: <1392647087-23020-4-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1392647087-23020-1-git-send-email-mst@redhat.com>

From: Joel Stanley <joel@jms.id.au>

peer_{de,at}tach were called from inside assert().
We don't support building without NDEBUG but it's not tidy.
Rearrange to attach peer outside assert calls.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/net/virtio-net.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3626608..535948d 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -401,12 +401,15 @@ static int peer_detach(VirtIONet *n, int index)
 static void virtio_net_set_queues(VirtIONet *n)
 {
     int i;
+    int r;
 
     for (i = 0; i < n->max_queues; i++) {
         if (i < n->curr_queues) {
-            assert(!peer_attach(n, i));
+            r = peer_attach(n, i);
+            assert(!r);
         } else {
-            assert(!peer_detach(n, i));
+            r = peer_detach(n, i);
+            assert(!r);
         }
     }
 }
-- 
MST

  parent reply	other threads:[~2014-02-17 14:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 14:25 [Qemu-devel] [PULL 0/5] acpi,pc,pci,virtio,memory bug fixes Michael S. Tsirkin
2014-02-17 14:25 ` [Qemu-devel] [PULL 1/5] acpi-build: append description for non-hotplug Michael S. Tsirkin
2014-02-17 14:51   ` Gabriel L. Somlo
2014-02-17 16:44     ` Michael S. Tsirkin
2014-02-19 13:52       ` Peter Maydell
2014-02-19 14:36         ` Michael S. Tsirkin
2014-02-19 13:50     ` Michael S. Tsirkin
2014-02-19 15:24       ` Gabriel L. Somlo
2014-02-19 19:09         ` Michael S. Tsirkin
2014-02-19 19:02       ` Michael S. Tsirkin
2014-02-19 19:45         ` Gabriel L. Somlo
2014-02-20  5:13           ` Michael S. Tsirkin
2014-02-20 14:22             ` Gabriel L. Somlo
2014-02-20 15:29               ` Michael S. Tsirkin
2014-02-19 16:09     ` Alex Williamson
2014-02-17 14:25 ` [Qemu-devel] [PULL 2/5] acpi-test-data: update expected files Michael S. Tsirkin
2014-02-17 14:25 ` Michael S. Tsirkin [this message]
2014-02-17 14:25 ` [Qemu-devel] [PULL 4/5] memory_region_present: return false if address is not found in child MemoryRegion Michael S. Tsirkin
2014-02-17 14:25 ` [Qemu-devel] [PULL 5/5] PCIE: fix regression with coldplugged multifunction device Michael S. Tsirkin
2014-02-19 14:35 ` [Qemu-devel] [PULL 0/5] acpi,pc,pci,virtio,memory bug fixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392647087-23020-4-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=joel@jms.id.au \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).