aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/nrf51_soc.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-11-20 13:36:35 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-01-05 16:20:15 +0100
commit2198f5f0f2f3f5470a9e3c0c1431dec022bb67ad (patch)
treeab84e79866de9510d46ca5e8ae18fa18a6e6ee68 /hw/arm/nrf51_soc.c
parent9c878ad6fbfc7934c9c4f6ba607c0842202afdbb (diff)
downloadqemu-2198f5f0f2f3f5470a9e3c0c1431dec022bb67ad.zip
qemu-2198f5f0f2f3f5470a9e3c0c1431dec022bb67ad.tar.gz
qemu-2198f5f0f2f3f5470a9e3c0c1431dec022bb67ad.tar.bz2
hw: Simplify memory_region_init_ram() calls
Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, errp; @@ - memory_region_init_ram(mr, owner, arg3, arg4, &errp); if ( - errp + !memory_region_init_ram(mr, owner, arg3, arg4, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> # aspeed Reviewed-by: Gavin Shan <gshan@redhat.com> Message-Id: <20231120213301.24349-21-philmd@linaro.org>
Diffstat (limited to 'hw/arm/nrf51_soc.c')
-rw-r--r--hw/arm/nrf51_soc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
index 34da0d6..ac53441 100644
--- a/hw/arm/nrf51_soc.c
+++ b/hw/arm/nrf51_soc.c
@@ -58,7 +58,6 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
{
NRF51State *s = NRF51_SOC(dev_soc);
MemoryRegion *mr;
- Error *err = NULL;
uint8_t i = 0;
hwaddr base_addr = 0;
@@ -92,10 +91,8 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion_overlap(&s->container, 0, s->board_memory, -1);
- memory_region_init_ram(&s->sram, OBJECT(s), "nrf51.sram", s->sram_size,
- &err);
- if (err) {
- error_propagate(errp, err);
+ if (!memory_region_init_ram(&s->sram, OBJECT(s), "nrf51.sram", s->sram_size,
+ errp)) {
return;
}
memory_region_add_subregion(&s->container, NRF51_SRAM_BASE, &s->sram);