[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-4.0 04/11] qemu_thread: supplement error handlin
From: |
Fei Li |
Subject: |
[Qemu-devel] [PATCH for-4.0 04/11] qemu_thread: supplement error handling for pci_edu_realize |
Date: |
Mon, 28 Jan 2019 22:14:47 +0800 |
From: Fei Li <address@hidden>
Utilize the existed errp to propagate the error and do the
corresponding cleanup to replace the temporary &error_abort.
Cc: Markus Armbruster <address@hidden>
Cc: Jiri Slaby <address@hidden>
Signed-off-by: Fei Li <address@hidden>
---
hw/misc/edu.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index d3583c6141..42c429de9a 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -356,9 +356,14 @@ static void pci_edu_realize(PCIDevice *pdev, Error **errp)
qemu_mutex_init(&edu->thr_mutex);
qemu_cond_init(&edu->thr_cond);
- /* TODO: let the further caller handle the error instead of abort() here */
- qemu_thread_create(&edu->thread, "edu", edu_fact_thread,
- edu, QEMU_THREAD_JOINABLE, &error_abort);
+ if (qemu_thread_create(&edu->thread, "edu", edu_fact_thread,
+ edu, QEMU_THREAD_JOINABLE, errp) < 0) {
+ qemu_cond_destroy(&edu->thr_cond);
+ qemu_mutex_destroy(&edu->thr_mutex);
+ timer_del(&edu->dma_timer);
+ msi_uninit(pdev);
+ return;
+ }
memory_region_init_io(&edu->mmio, OBJECT(edu), &edu_mmio_ops, edu,
"edu-mmio", 1 * MiB);
--
2.17.2 (Apple Git-113)
- [Qemu-devel] [PATCH for-4.0 00/11] qemu_thread_create: propagate the error to callers to handle, Fei Li, 2019/01/28
- [Qemu-devel] [PATCH for-4.0 03/11] qemu_thread: supplement error handling for qmp_dump_guest_memory, Fei Li, 2019/01/28
- [Qemu-devel] [PATCH for-4.0 06/11] qemu_thread: supplement error handling for emulated_realize, Fei Li, 2019/01/28
- [Qemu-devel] [PATCH for-4.0 04/11] qemu_thread: supplement error handling for pci_edu_realize,
Fei Li <=
- [Qemu-devel] [PATCH for-4.0 05/11] qemu_thread: supplement error handling for h_resize_hpt_prepare, Fei Li, 2019/01/28
- [Qemu-devel] [PATCH for-4.0 02/11] qemu_thread: supplement error handling for qemu_X_start_vcpu, Fei Li, 2019/01/28
- [Qemu-devel] [PATCH for-4.0 07/11] qemu_thread: supplement error handling for iothread_complete, Fei Li, 2019/01/28
- [Qemu-devel] [PATCH for-4.0 01/11] qemu_thread: make qemu_thread_create() take Error ** argument, Fei Li, 2019/01/28
- Re: [Qemu-devel] [PATCH for-4.0 00/11] qemu_thread_create: propagate the error to callers to handle, Markus Armbruster, 2019/01/31