hw/arm: Simplify memory_region_init_rom() calls
Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, errp; @@ - memory_region_init_rom(mr, owner, arg3, arg4, &errp); if ( - errp + !memory_region_init_rom(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: Gavin Shan <gshan@redhat.com> Message-Id: <20231120213301.24349-22-philmd@linaro.org>
This commit is contained in:
parent
2198f5f0f2
commit
419d8524a2
@ -81,7 +81,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
FslIMX25State *s = FSL_IMX25(dev);
|
||||
uint8_t i;
|
||||
Error *err = NULL;
|
||||
|
||||
if (!qdev_realize(DEVICE(&s->cpu), NULL, errp)) {
|
||||
return;
|
||||
@ -281,18 +280,14 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
|
||||
FSL_IMX25_WDT_IRQ));
|
||||
|
||||
/* initialize 2 x 16 KB ROM */
|
||||
memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0",
|
||||
FSL_IMX25_ROM0_SIZE, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0",
|
||||
FSL_IMX25_ROM0_SIZE, errp)) {
|
||||
return;
|
||||
}
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM0_ADDR,
|
||||
&s->rom[0]);
|
||||
memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1",
|
||||
FSL_IMX25_ROM1_SIZE, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1",
|
||||
FSL_IMX25_ROM1_SIZE, errp)) {
|
||||
return;
|
||||
}
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM1_ADDR,
|
||||
|
@ -63,7 +63,6 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
FslIMX31State *s = FSL_IMX31(dev);
|
||||
uint16_t i;
|
||||
Error *err = NULL;
|
||||
|
||||
if (!qdev_realize(DEVICE(&s->cpu), NULL, errp)) {
|
||||
return;
|
||||
@ -188,20 +187,16 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR);
|
||||
|
||||
/* On a real system, the first 16k is a `secure boot rom' */
|
||||
memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom",
|
||||
FSL_IMX31_SECURE_ROM_SIZE, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom",
|
||||
FSL_IMX31_SECURE_ROM_SIZE, errp)) {
|
||||
return;
|
||||
}
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX31_SECURE_ROM_ADDR,
|
||||
&s->secure_rom);
|
||||
|
||||
/* There is also a 16k ROM */
|
||||
memory_region_init_rom(&s->rom, OBJECT(dev), "imx31.rom",
|
||||
FSL_IMX31_ROM_SIZE, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!memory_region_init_rom(&s->rom, OBJECT(dev), "imx31.rom",
|
||||
FSL_IMX31_ROM_SIZE, errp)) {
|
||||
return;
|
||||
}
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX31_ROM_ADDR,
|
||||
|
@ -109,7 +109,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
FslIMX6State *s = FSL_IMX6(dev);
|
||||
uint16_t i;
|
||||
Error *err = NULL;
|
||||
unsigned int smp_cpus = ms->smp.cpus;
|
||||
|
||||
if (smp_cpus > FSL_IMX6_NUM_CPUS) {
|
||||
@ -423,20 +422,16 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
/* ROM memory */
|
||||
memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom",
|
||||
FSL_IMX6_ROM_SIZE, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom",
|
||||
FSL_IMX6_ROM_SIZE, errp)) {
|
||||
return;
|
||||
}
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX6_ROM_ADDR,
|
||||
&s->rom);
|
||||
|
||||
/* CAAM memory */
|
||||
memory_region_init_rom(&s->caam, OBJECT(dev), "imx6.caam",
|
||||
FSL_IMX6_CAAM_MEM_SIZE, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!memory_region_init_rom(&s->caam, OBJECT(dev), "imx6.caam",
|
||||
FSL_IMX6_CAAM_MEM_SIZE, errp)) {
|
||||
return;
|
||||
}
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX6_CAAM_MEM_ADDR,
|
||||
|
Loading…
Reference in New Issue
Block a user