qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio-net: remove function calls from assert


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] virtio-net: remove function calls from assert
Date: Tue, 11 Feb 2014 07:10:08 +0200

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 <address@hidden>
> 
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]