Commit ddfa83ea authored by Joel Stanley's avatar Joel Stanley Committed by Michael S. Tsirkin
Browse files

virtio-net: remove function calls from assert



peer_{de,at}tach were called from inside assert().
We don't support building without NDEBUG but it's not tidy.
Rearrange to attach peer outside assert calls.

Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 6cb46e1e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -397,12 +397,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);
        }
    }
}