From: "Michael S. Tsirkin" <mst@redhat.com>
To: Joel Stanley <joel@jms.id.au>
Cc: qemu-devel@nongnu.org, aliguori@amazon.com
Subject: Re: [Qemu-devel] [PATCH] virtio-net: remove function calls from assert
Date: Tue, 11 Feb 2014 07:10:08 +0200 [thread overview]
Message-ID: <20140211051008.GA1372@redhat.com> (raw)
In-Reply-To: <20140211050317.GA1367@redhat.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 <joel@jms.id.au>
>
> 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
next prev parent reply other threads:[~2014-02-11 5:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 0:12 [Qemu-devel] [PATCH] virtio-net: remove function calls from assert Joel Stanley
2014-02-11 5:03 ` Michael S. Tsirkin
2014-02-11 5:10 ` Michael S. Tsirkin [this message]
2014-02-11 8:01 ` Joel Stanley
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=20140211051008.GA1372@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@amazon.com \
--cc=joel@jms.id.au \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.