From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9bkt-0003xp-3g for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:50:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9bko-0007Xd-V8 for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:50:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9bko-0007XN-Qj for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:50:10 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 6BFA08F512 for ; Thu, 17 Dec 2015 16:50:10 +0000 (UTC) Received: from blackfin.pond.sub.org ([10.3.113.12]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBHGo7Nr005151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 17 Dec 2015 11:50:09 -0500 From: Markus Armbruster Date: Thu, 17 Dec 2015 17:49:49 +0100 Message-Id: <1450371004-26866-9-git-send-email-armbru@redhat.com> In-Reply-To: <1450371004-26866-1-git-send-email-armbru@redhat.com> References: <1450371004-26866-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 08/23] test-throttle: Simplify qemu_init_main_loop() error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The code looks like it tries to check for both qemu_init_main_loop() and qemu_get_aio_context() failure in one conditional. In fact, qemu_get_aio_context() can fail only after qemu_init_main_loop() failed. Simplify accordingly: check for qemu_init_main_loop() error directly, without bothering to improve its error message. Call qemu_get_aio_context() only when qemu_get_aio_context() succeeded. It can't fail then, so no need to check. Signed-off-by: Markus Armbruster --- tests/test-throttle.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tests/test-throttle.c b/tests/test-throttle.c index 85c9b6c..a95039f 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -581,21 +581,8 @@ static void test_groups(void) int main(int argc, char **argv) { - Error *local_error = NULL; - - qemu_init_main_loop(&local_error); + qemu_init_main_loop(&error_fatal); ctx = qemu_get_aio_context(); - - if (!ctx) { - error_report("Failed to create AIO Context: '%s'", - local_error ? error_get_pretty(local_error) : - "Failed to initialize the QEMU main loop"); - if (local_error) { - error_free(local_error); - } - exit(1); - } - bdrv_init(); do {} while (g_main_context_iteration(NULL, false)); -- 2.4.3