diff options
author | Peter Maydell | 2021-08-12 11:33:41 +0200 |
---|---|---|
committer | Peter Maydell | 2021-09-01 12:08:19 +0200 |
commit | cabc613f78fc0409ed3cd35994cd85ed3a0915f1 (patch) | |
tree | a494335a1723364ad5cec20291a19a94d637e2d1 /include/hw/arm | |
parent | clock: Provide builtin multiplier/divider (diff) | |
download | qemu-cabc613f78fc0409ed3cd35994cd85ed3a0915f1.tar.gz qemu-cabc613f78fc0409ed3cd35994cd85ed3a0915f1.tar.xz qemu-cabc613f78fc0409ed3cd35994cd85ed3a0915f1.zip |
hw/arm: Don't allocate separate MemoryRegions in stm32 SoC realize
In the realize methods of the stm32f100 and stm32f205 SoC objects, we
call g_new() to create new MemoryRegion objects for the sram, flash,
and flash_alias. This is unnecessary (and leaves open the
possibility of leaking the allocations if we exit from realize with
an error). Make these MemoryRegions member fields of the device
state struct instead, as stm32f405 already does.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alexandre Iooss <erdnaxe@crans.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Luc Michel <luc@lmichel.fr>
Message-id: 20210812093356.1946-11-peter.maydell@linaro.org
Diffstat (limited to 'include/hw/arm')
-rw-r--r-- | include/hw/arm/stm32f100_soc.h | 4 | ||||
-rw-r--r-- | include/hw/arm/stm32f205_soc.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/hw/arm/stm32f100_soc.h b/include/hw/arm/stm32f100_soc.h index 71bffcf4fd..b7d71c6c63 100644 --- a/include/hw/arm/stm32f100_soc.h +++ b/include/hw/arm/stm32f100_soc.h @@ -52,6 +52,10 @@ struct STM32F100State { STM32F2XXUsartState usart[STM_NUM_USARTS]; STM32F2XXSPIState spi[STM_NUM_SPIS]; + + MemoryRegion sram; + MemoryRegion flash; + MemoryRegion flash_alias; }; #endif diff --git a/include/hw/arm/stm32f205_soc.h b/include/hw/arm/stm32f205_soc.h index 985ff63aa9..7525149491 100644 --- a/include/hw/arm/stm32f205_soc.h +++ b/include/hw/arm/stm32f205_soc.h @@ -63,6 +63,10 @@ struct STM32F205State { STM32F2XXSPIState spi[STM_NUM_SPIS]; qemu_or_irq *adc_irqs; + + MemoryRegion sram; + MemoryRegion flash; + MemoryRegion flash_alias; }; #endif |