[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/41] test-throttle: Simplify qemu_init_main_loop()
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 24/41] test-throttle: Simplify qemu_init_main_loop() error handling |
Date: |
Wed, 13 Jan 2016 16:43:22 +0100 |
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
---
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
- [Qemu-devel] [PULL 00/41] Error reporting patches for 2016-01-13, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 01/41] error: Document how to accumulate multiple errors, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 03/41] hw: Inline the qdev_prop_set_drive_nofail() wrapper, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 09/41] error: Don't append a newline when printing the error hint, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 08/41] raven: Mark use of hw_error() in realize() FIXME, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 15/41] audio: Clean up inappropriate and unreachable use of hw_error(), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 24/41] test-throttle: Simplify qemu_init_main_loop() error handling,
Markus Armbruster <=
- [Qemu-devel] [PULL 20/41] error: Use error_report_err() instead of ad hoc prints, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 13/41] isa: Clean up error handling around isa_bus_new(), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 18/41] error: Use error_report_err() where appropriate (again), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 21/41] error: Improve documentation, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 36/41] vhdx: Fix "log that needs to be replayed" error message, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 02/41] Use error_fatal to simplify obvious fatal errors, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 05/41] omap: Don't use hw_error() in device init() methods, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 07/41] etraxfs_eth: Don't use hw_error() in init() method, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 11/41] sysbus: Don't use hw_error() in machine_init_done_notifiers, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 17/41] qemu-nbd: Replace BSDism <err.h> by error_report(), Markus Armbruster, 2016/01/13