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: Joel Stanley <joel@jms.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Joel Stanley 2014-02-11 10:42:02 +10:30 committed by Michael S. Tsirkin
parent 6cb46e1e90
commit ddfa83ea06

View File

@ -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);
}
}
}