[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/38] hw/arm: Remove unreachable code calling pflash_cfi01_regist
From: |
Peter Maydell |
Subject: |
[PULL 23/38] hw/arm: Remove unreachable code calling pflash_cfi01_register() |
Date: |
Fri, 13 Jan 2023 14:11:11 +0000 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Since its QOM'ification in commit 368a354f02 ("pflash_cfi0x:
QOMified") the pflash_cfi01_register() function does not fail.
This call was later converted with a script to use &error_fatal,
still unable to fail. Remove the unreachable code.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230109115316.2235-14-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/gumstix.c | 18 ++++++------------
hw/arm/mainstone.c | 13 +++++--------
hw/arm/omap_sx1.c | 22 ++++++++--------------
hw/arm/versatilepb.c | 6 ++----
hw/arm/z2.c | 9 +++------
5 files changed, 24 insertions(+), 44 deletions(-)
diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c
index 579d3635774..2ca4140c9fc 100644
--- a/hw/arm/gumstix.c
+++ b/hw/arm/gumstix.c
@@ -69,12 +69,9 @@ static void connex_init(MachineState *machine)
}
/* Numonyx RC28F128J3F75 */
- if (!pflash_cfi01_register(0x00000000, "connext.rom", CONNEX_FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0)) {
- error_report("Error registering flash memory");
- exit(1);
- }
+ pflash_cfi01_register(0x00000000, "connext.rom", CONNEX_FLASH_SIZE,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+ FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0);
/* Interrupt line of NIC is connected to GPIO line 36 */
smc91c111_init(&nd_table[0], 0x04000300,
@@ -96,12 +93,9 @@ static void verdex_init(MachineState *machine)
}
/* Micron RC28F256P30TFA */
- if (!pflash_cfi01_register(0x00000000, "verdex.rom", VERDEX_FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0)) {
- error_report("Error registering flash memory");
- exit(1);
- }
+ pflash_cfi01_register(0x00000000, "verdex.rom", VERDEX_FLASH_SIZE,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+ FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0);
/* Interrupt line of NIC is connected to GPIO line 99 */
smc91c111_init(&nd_table[0], 0x04000300,
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index eebaed6e3ea..68329c46178 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -130,14 +130,11 @@ static void mainstone_common_init(MachineState *machine,
/* There are two 32MiB flash devices on the board */
for (i = 0; i < 2; i ++) {
dinfo = drive_get(IF_PFLASH, 0, i);
- if (!pflash_cfi01_register(mainstone_flash_base[i],
- i ? "mainstone.flash1" : "mainstone.flash0",
- MAINSTONE_FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE, 4, 0, 0, 0, 0, 0)) {
- error_report("Error registering flash memory");
- exit(1);
- }
+ pflash_cfi01_register(mainstone_flash_base[i],
+ i ? "mainstone.flash1" : "mainstone.flash0",
+ MAINSTONE_FLASH_SIZE,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+ FLASH_SECTOR_SIZE, 4, 0, 0, 0, 0, 0);
}
mst_irq = sysbus_create_simple("mainstone-fpga", MST_FPGA_PHYS,
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index d1b0ec3264e..1d156bc3441 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -152,13 +152,10 @@ static void sx1_init(MachineState *machine, const int
version)
fl_idx = 0;
if ((dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) {
- if (!pflash_cfi01_register(OMAP_CS0_BASE,
- "omap_sx1.flash0-1", flash_size,
- blk_by_legacy_dinfo(dinfo),
- SECTOR_SIZE, 4, 0, 0, 0, 0, 0)) {
- fprintf(stderr, "qemu: Error registering flash memory %d.\n",
- fl_idx);
- }
+ pflash_cfi01_register(OMAP_CS0_BASE,
+ "omap_sx1.flash0-1", flash_size,
+ blk_by_legacy_dinfo(dinfo),
+ SECTOR_SIZE, 4, 0, 0, 0, 0, 0);
fl_idx++;
}
@@ -174,13 +171,10 @@ static void sx1_init(MachineState *machine, const int
version)
memory_region_add_subregion(address_space,
OMAP_CS1_BASE + FLASH1_SIZE, &cs[1]);
- if (!pflash_cfi01_register(OMAP_CS1_BASE,
- "omap_sx1.flash1-1", FLASH1_SIZE,
- blk_by_legacy_dinfo(dinfo),
- SECTOR_SIZE, 4, 0, 0, 0, 0, 0)) {
- fprintf(stderr, "qemu: Error registering flash memory %d.\n",
- fl_idx);
- }
+ pflash_cfi01_register(OMAP_CS1_BASE,
+ "omap_sx1.flash1-1", FLASH1_SIZE,
+ blk_by_legacy_dinfo(dinfo),
+ SECTOR_SIZE, 4, 0, 0, 0, 0, 0);
fl_idx++;
} else {
memory_region_init_io(&cs[1], NULL, &static_ops, &cs1val,
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index ecc1f6cf74f..43172d72ea4 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -385,13 +385,11 @@ static void versatile_init(MachineState *machine, int
board_id)
/* 0x34000000 NOR Flash */
dinfo = drive_get(IF_PFLASH, 0, 0);
- if (!pflash_cfi01_register(VERSATILE_FLASH_ADDR, "versatile.flash",
+ pflash_cfi01_register(VERSATILE_FLASH_ADDR, "versatile.flash",
VERSATILE_FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
VERSATILE_FLASH_SECT_SIZE,
- 4, 0x0089, 0x0018, 0x0000, 0x0, 0)) {
- fprintf(stderr, "qemu: Error registering flash memory.\n");
- }
+ 4, 0x0089, 0x0018, 0x0000, 0x0, 0);
versatile_binfo.ram_size = machine->ram_size;
versatile_binfo.board_id = board_id;
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 839be3ca169..dc25304290a 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -312,12 +312,9 @@ static void z2_init(MachineState *machine)
mpu = pxa270_init(z2_binfo.ram_size, machine->cpu_type);
dinfo = drive_get(IF_PFLASH, 0, 0);
- if (!pflash_cfi01_register(Z2_FLASH_BASE, "z2.flash0", Z2_FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE, 4, 0, 0, 0, 0, 0)) {
- error_report("Error registering flash memory");
- exit(1);
- }
+ pflash_cfi01_register(Z2_FLASH_BASE, "z2.flash0", Z2_FLASH_SIZE,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+ FLASH_SECTOR_SIZE, 4, 0, 0, 0, 0, 0);
/* setup keypad */
pxa27x_register_keypad(mpu->kp, map, 0x100);
--
2.34.1
- [PULL 10/38] target/arm: Fix sve_probe_page, (continued)
- [PULL 10/38] target/arm: Fix sve_probe_page, Peter Maydell, 2023/01/13
- [PULL 11/38] hw/arm/pxa2xx: Simplify pxa255_init(), Peter Maydell, 2023/01/13
- [PULL 04/38] hw/misc: Allwinner A10 DRAM Controller Emulation, Peter Maydell, 2023/01/13
- [PULL 03/38] hw/misc: Allwinner-A10 Clock Controller Module Emulation, Peter Maydell, 2023/01/13
- [PULL 09/38] tests/avocado: Add SD boot test to Cubieboard, Peter Maydell, 2023/01/13
- [PULL 15/38] hw/arm/gumstix: Improve documentation, Peter Maydell, 2023/01/13
- [PULL 21/38] hw/arm/z2: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 06/38] hw/misc: AXP209 PMU Emulation, Peter Maydell, 2023/01/13
- [PULL 08/38] hw/arm: Allwinner A10 enable SPL load from MMC, Peter Maydell, 2023/01/13
- [PULL 13/38] hw/arm/collie: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 23/38] hw/arm: Remove unreachable code calling pflash_cfi01_register(),
Peter Maydell <=
- [PULL 18/38] hw/arm/musicpal: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 30/38] hw/arm/stellaris: Drop useless casts from void * to pointer, Peter Maydell, 2023/01/13
- [PULL 16/38] hw/arm/gumstix: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 28/38] hw/gpio/omap_gpio: Use CamelCase for TYPE_OMAP2_GPIO type name, Peter Maydell, 2023/01/13
- [PULL 20/38] hw/arm/omap_sx1: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 19/38] hw/arm/omap_sx1: Remove unused 'total_ram' definitions, Peter Maydell, 2023/01/13
- [PULL 27/38] hw/gpio/omap_gpio: Use CamelCase for TYPE_OMAP1_GPIO type name, Peter Maydell, 2023/01/13
- [PULL 37/38] hw/timer/xilinx_timer: Use XpsTimerState instead of 'struct timerblock', Peter Maydell, 2023/01/13
- [PULL 35/38] hw/misc/sbsa_ec: Declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE(), Peter Maydell, 2023/01/13
- [PULL 31/38] hw/arm/stellaris: Use CamelCase for STELLARIS_ADC type name, Peter Maydell, 2023/01/13