diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-04-20 15:52:44 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-04-26 13:57:00 +0100 |
commit | fc38a1120c2fabb76546ef8980e6d18b5fb7e843 (patch) | |
tree | 3b58b52e56a00a7ac26ef416b88dd0a3ba8bf417 /hw/arm/mps2.c | |
parent | 9bca0edb282de0007a4f068d9d20f3e3c3aadef7 (diff) |
Remove checks on MAX_SERIAL_PORTS that are just bounds checks
Remove checks on MAX_SERIAL_PORTS that were just checking whether
they were within bounds for the serial_hds[] array and falling
back to NULL if not. This isn't needed with the serial_hd()
function, which returns NULL for all indexes beyond what the
user set up.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180420145249.32435-9-peter.maydell@linaro.org
Diffstat (limited to 'hw/arm/mps2.c')
-rw-r--r-- | hw/arm/mps2.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index eb550fad34..c3946da317 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -230,7 +230,6 @@ static void mps2_common_init(MachineState *machine) static const hwaddr uartbase[] = {0x40004000, 0x40005000, 0x40006000, 0x40007000, 0x40009000}; - Chardev *uartchr = i < MAX_SERIAL_PORTS ? serial_hd(i) : NULL; /* RX irq number; TX irq is always one greater */ static const int uartirq[] = {0, 2, 4, 18, 20}; qemu_irq txovrint = NULL, rxovrint = NULL; @@ -245,7 +244,7 @@ static void mps2_common_init(MachineState *machine) qdev_get_gpio_in(armv7m, uartirq[i]), txovrint, rxovrint, NULL, - uartchr, SYSCLK_FRQ); + serial_hd(i), SYSCLK_FRQ); } break; } @@ -270,7 +269,6 @@ static void mps2_common_init(MachineState *machine) static const hwaddr uartbase[] = {0x40004000, 0x40005000, 0x4002c000, 0x4002d000, 0x4002e000}; - Chardev *uartchr = i < MAX_SERIAL_PORTS ? serial_hd(i) : NULL; Object *txrx_orgate; DeviceState *txrx_orgate_dev; @@ -287,7 +285,7 @@ static void mps2_common_init(MachineState *machine) qdev_get_gpio_in(orgate_dev, i * 2), qdev_get_gpio_in(orgate_dev, i * 2 + 1), NULL, - uartchr, SYSCLK_FRQ); + serial_hd(i), SYSCLK_FRQ); } break; } |