From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD5X3-0005nf-AG for qemu-devel@nongnu.org; Tue, 11 Feb 2014 00:05:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WD5Wy-0007Ra-5O for qemu-devel@nongnu.org; Tue, 11 Feb 2014 00:05:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD5Wx-0007RW-U7 for qemu-devel@nongnu.org; Tue, 11 Feb 2014 00:05:12 -0500 Date: Tue, 11 Feb 2014 07:10:08 +0200 From: "Michael S. Tsirkin" Message-ID: <20140211051008.GA1372@redhat.com> References: <1392077522-11903-1-git-send-email-joel@jms.id.au> <20140211050317.GA1367@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140211050317.GA1367@redhat.com> Subject: Re: [Qemu-devel] [PATCH] virtio-net: remove function calls from assert List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Joel Stanley Cc: qemu-devel@nongnu.org, aliguori@amazon.com On Tue, Feb 11, 2014 at 07:03:17AM +0200, Michael S. Tsirkin wrote: > On Tue, Feb 11, 2014 at 10:42:02AM +1030, Joel Stanley wrote: > > peer_{de,at}tach were called from inside assert(). This will be a > > problem for virtio-net if built with NDEBUG. > > > > Signed-off-by: Joel Stanley > > Thanks, applied. Just to clarify, I applied this because code looks nicer this way. We don't support build with NDEBUG - a whole bunch of stuff will break if you do. I tweaked the commit log to make this clear. > > --- > > 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); > > } > > } > > } > > -- > > 1.9.rc1