diff options
Diffstat (limited to 'hw/arm/nrf51_soc.c')
-rw-r--r-- | hw/arm/nrf51_soc.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c index 20dd8b5897..45e6cc97d7 100644 --- a/hw/arm/nrf51_soc.c +++ b/hw/arm/nrf51_soc.c @@ -65,11 +65,9 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) return; } - object_property_set_link(OBJECT(&s->cpu), OBJECT(&s->container), "memory", + object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container), &error_abort); - sysbus_realize(SYS_BUS_DEVICE(&s->cpu), &err); - if (err) { - error_propagate(errp, err); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) { return; } @@ -84,9 +82,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) memory_region_add_subregion(&s->container, NRF51_SRAM_BASE, &s->sram); /* UART */ - sysbus_realize(SYS_BUS_DEVICE(&s->uart), &err); - if (err) { - error_propagate(errp, err); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart), errp)) { return; } mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0); @@ -96,9 +92,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) BASE_TO_IRQ(NRF51_UART_BASE))); /* RNG */ - sysbus_realize(SYS_BUS_DEVICE(&s->rng), &err); - if (err) { - error_propagate(errp, err); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->rng), errp)) { return; } @@ -109,16 +103,12 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) BASE_TO_IRQ(NRF51_RNG_BASE))); /* UICR, FICR, NVMC, FLASH */ - object_property_set_uint(OBJECT(&s->nvm), s->flash_size, "flash-size", - &err); - if (err) { - error_propagate(errp, err); + if (!object_property_set_uint(OBJECT(&s->nvm), "flash-size", + s->flash_size, errp)) { return; } - sysbus_realize(SYS_BUS_DEVICE(&s->nvm), &err); - if (err) { - error_propagate(errp, err); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->nvm), errp)) { return; } @@ -132,9 +122,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) memory_region_add_subregion_overlap(&s->container, NRF51_FLASH_BASE, mr, 0); /* GPIO */ - sysbus_realize(SYS_BUS_DEVICE(&s->gpio), &err); - if (err) { - error_propagate(errp, err); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { return; } @@ -146,14 +134,10 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) /* TIMER */ for (i = 0; i < NRF51_NUM_TIMERS; i++) { - object_property_set_uint(OBJECT(&s->timer[i]), i, "id", &err); - if (err) { - error_propagate(errp, err); + if (!object_property_set_uint(OBJECT(&s->timer[i]), "id", i, errp)) { return; } - sysbus_realize(SYS_BUS_DEVICE(&s->timer[i]), &err); - if (err) { - error_propagate(errp, err); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer[i]), errp)) { return; } |