All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-net: remove function calls from assert
@ 2014-02-11  0:12 Joel Stanley
  2014-02-11  5:03 ` Michael S. Tsirkin
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Stanley @ 2014-02-11  0:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, mst

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>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: remove function calls from assert
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-02-11  5:03 UTC (permalink / raw)
  To: Joel Stanley; +Cc: qemu-devel, aliguori

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.

> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: remove function calls from assert
  2014-02-11  5:03 ` Michael S. Tsirkin
@ 2014-02-11  5:10   ` Michael S. Tsirkin
  2014-02-11  8:01     ` Joel Stanley
  0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-02-11  5:10 UTC (permalink / raw)
  To: Joel Stanley; +Cc: qemu-devel, aliguori

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: remove function calls from assert
  2014-02-11  5:10   ` Michael S. Tsirkin
@ 2014-02-11  8:01     ` Joel Stanley
  0 siblings, 0 replies; 4+ messages in thread
From: Joel Stanley @ 2014-02-11  8:01 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, aliguori

On Tue, Feb 11, 2014 at 3:40 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> 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.

Ok. Thanks for clarifying that.

Joel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-11  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2014-02-11  8:01     ` Joel Stanley

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.