[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/26] aspeed: Clean up roundabout error propagation
From: |
Markus Armbruster |
Subject: |
[PATCH v3 12/26] aspeed: Clean up roundabout error propagation |
Date: |
Tue, 30 Jun 2020 11:03:37 +0200 |
Replace
sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), &local_err);
error_propagate(&err, local_err);
if (err) {
error_propagate(errp, err);
return;
}
by
sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), &err);
if (err) {
error_propagate(errp, err);
return;
}
Cc: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
---
hw/arm/aspeed_ast2600.c | 10 ++++------
hw/arm/aspeed_soc.c | 10 ++++------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index 6da687299f..08b3592e36 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -228,7 +228,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev,
Error **errp)
int i;
AspeedSoCState *s = ASPEED_SOC(dev);
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
- Error *err = NULL, *local_err = NULL;
+ Error *err = NULL;
qemu_irq irq;
/* IO space */
@@ -394,8 +394,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev,
Error **errp)
return;
}
object_property_set_int(OBJECT(&s->spi[i]), 1, "num-cs", &err);
- sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), &local_err);
- error_propagate(&err, local_err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -446,11 +445,10 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev,
Error **errp)
for (i = 0; i < sc->macs_num; i++) {
object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed",
&err);
- sysbus_realize(SYS_BUS_DEVICE(&s->ftgmac100[i]), &local_err);
- error_propagate(&err, local_err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->ftgmac100[i]), &err);
if (err) {
error_propagate(errp, err);
- return;
+ return;
}
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
sc->memmap[ASPEED_ETH1 + i]);
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index 810cf9b6cc..ec21de50ce 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -218,7 +218,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error
**errp)
int i;
AspeedSoCState *s = ASPEED_SOC(dev);
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
- Error *err = NULL, *local_err = NULL;
+ Error *err = NULL;
/* IO space */
create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_IOMEM],
@@ -340,8 +340,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error
**errp)
/* SPI */
for (i = 0; i < sc->spis_num; i++) {
object_property_set_int(OBJECT(&s->spi[i]), 1, "num-cs", &err);
- sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), &local_err);
- error_propagate(&err, local_err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -392,11 +391,10 @@ static void aspeed_soc_realize(DeviceState *dev, Error
**errp)
for (i = 0; i < sc->macs_num; i++) {
object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed",
&err);
- sysbus_realize(SYS_BUS_DEVICE(&s->ftgmac100[i]), &local_err);
- error_propagate(&err, local_err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->ftgmac100[i]), &err);
if (err) {
error_propagate(errp, err);
- return;
+ return;
}
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
sc->memmap[ASPEED_ETH1 + i]);
--
2.26.2
- [PATCH v3 00/26] Error handling fixes & cleanups, Markus Armbruster, 2020/06/30
- [PATCH v3 04/26] tests: Use &error_abort where appropriate, Markus Armbruster, 2020/06/30
- [PATCH v3 10/26] test-util-filemonitor: Plug unlikely memory leak, Markus Armbruster, 2020/06/30
- [PATCH v3 05/26] tests: Use error_free_or_abort() where appropriate, Markus Armbruster, 2020/06/30
- [PATCH v3 08/26] qga: Plug unlikely memory leak in guest-set-memory-blocks, Markus Armbruster, 2020/06/30
- [PATCH v3 07/26] spapr: Plug minor memory leak in spapr_machine_init(), Markus Armbruster, 2020/06/30
- [PATCH v3 09/26] sd/milkymist-memcard: Plug minor memory leak in realize, Markus Armbruster, 2020/06/30
- [PATCH v3 12/26] aspeed: Clean up roundabout error propagation,
Markus Armbruster <=
- [PATCH v3 13/26] qdev: Drop qbus_set_bus_hotplug_handler() parameter @errp, Markus Armbruster, 2020/06/30
- [PATCH v3 14/26] qdev: Drop qbus_set_hotplug_handler() parameter @errp, Markus Armbruster, 2020/06/30
- [PATCH v3 03/26] Clean up some calls to ignore Error objects the right way, Markus Armbruster, 2020/06/30
- [PATCH v3 22/26] arm/stm32f205 arm/stm32f405: Fix realize error API violation, Markus Armbruster, 2020/06/30
- [PATCH v3 20/26] x86: Fix x86_cpu_new() error handling, Markus Armbruster, 2020/06/30
- [PATCH v3 06/26] usb/dev-mtp: Fix Error double free after inotify failure, Markus Armbruster, 2020/06/30
- [PATCH v3 26/26] migration/rdma: Plug memory leaks in qemu_rdma_registration_stop(), Markus Armbruster, 2020/06/30