From patchwork Tue Mar 4 13:03:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 326281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 584FD2C00BE for ; Wed, 5 Mar 2014 00:07:15 +1100 (EST) Received: from localhost ([::1]:44776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKp3w-0007QN-L3 for incoming@patchwork.ozlabs.org; Tue, 04 Mar 2014 08:07:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKp0E-0003Du-KX for qemu-devel@nongnu.org; Tue, 04 Mar 2014 08:03:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKp09-0002cX-GJ for qemu-devel@nongnu.org; Tue, 04 Mar 2014 08:03:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKp09-0002cF-87 for qemu-devel@nongnu.org; Tue, 04 Mar 2014 08:03:17 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s24D3BRO008266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 4 Mar 2014 08:03:12 -0500 Received: from redhat.com (dhcp-4-223.tlv.redhat.com [10.35.4.223]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id s24D399l004399; Tue, 4 Mar 2014 08:03:10 -0500 Date: Tue, 4 Mar 2014 15:03:09 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1393937889-14553-4-git-send-email-mst@redhat.com> References: <1393937889-14553-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1393937889-14553-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Joel Stanley , Anthony Liguori Subject: [Qemu-devel] [PULL 03/12] virtio-net: remove function calls from assert X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Joel Stanley 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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); } } }