virtio-net: remove function calls from assert
PATCH 1/1 virtio-net: remove function calls from assert
peer_{de,at}tach were called from inside assert(). This will be a problem for virtio-net if built with NDEBUG.
--- hw/net/virtio-net.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
hw/net/virtio-net.c +5 -2
@@ -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); } } }
Signature · 1 line
1.9.rc1
Michael S. Tsirkin
AppliedQuoted 4 lines · Joel Stanley
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 <[email protected]>
Thanks, applied.
Quoted 28 lines
--- hw/net/virtio-net.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)hw/net/virtio-net.c +5
-2@@ -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); } } }Signature · 1 line
1.9.rc1
Quoted 7 lines · Michael S. Tsirkin
Quoted 4 lines · Joel Stanley
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 <[email protected]>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.
Quoted 28 lines
Quoted 28 lines
--- hw/net/virtio-net.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)hw/net/virtio-net.c +5
-2@@ -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); } } }Signature · 1 line
1.9.rc1
Quoted 4 lines · Michael S. Tsirkin
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