[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/44] macio: Tidy up error handling in macio_newworld_realize
From: |
Markus Armbruster |
Subject: |
[PATCH v2 04/44] macio: Tidy up error handling in macio_newworld_realize() |
Date: |
Thu, 2 Jul 2020 17:49:20 +0200 |
macio_newworld_realize() effectively ignores ns->gpio realization
errors, leaking the Error object. Fortunately, macio_gpio_realize()
can't actually fail. Tidy up.
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
hw/misc/macio/macio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 42414797e2..be66bb7758 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -334,7 +334,9 @@ static void macio_newworld_realize(PCIDevice *d, Error
**errp)
&error_abort);
memory_region_add_subregion(&s->bar, 0x50,
sysbus_mmio_get_region(sysbus_dev, 0));
- qdev_realize(DEVICE(&ns->gpio), BUS(&s->macio_bus), &err);
+ if (!qdev_realize(DEVICE(&ns->gpio), BUS(&s->macio_bus), errp)) {
+ return;
+ }
/* PMU */
object_initialize_child(OBJECT(s), "pmu", &s->pmu, TYPE_VIA_PMU);
--
2.26.2
- [PATCH v2 00/44] Less clumsy error checking, Markus Armbruster, 2020/07/02
- [PATCH v2 02/44] error: Document Error API usage rules, Markus Armbruster, 2020/07/02
- [PATCH v2 04/44] macio: Tidy up error handling in macio_newworld_realize(),
Markus Armbruster <=
- [PATCH v2 11/44] qemu-option: Replace opt_set() by cleaner opt_validate(), Markus Armbruster, 2020/07/02
- [PATCH v2 09/44] qemu-option: Simplify around find_default_by_name(), Markus Armbruster, 2020/07/02
- [PATCH v2 13/44] qemu-option: Use returned bool to check for failure, Markus Armbruster, 2020/07/02
- [PATCH v2 01/44] error: Improve examples in error.h's big comment, Markus Armbruster, 2020/07/02
- [PATCH v2 08/44] qemu-option: Factor out helper find_default_by_name(), Markus Armbruster, 2020/07/02
- [PATCH v2 21/44] qom: Use error_reportf_err() instead of g_printerr() in examples, Markus Armbruster, 2020/07/02