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-tz.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-tz.c')
-rw-r--r-- | hw/arm/mps2-tz.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 4ae4a5cb2a..8dc8bfd4ab 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -172,7 +172,6 @@ static MemoryRegion *make_uart(MPS2TZMachineState *mms, void *opaque, { CMSDKAPBUART *uart = opaque; int i = uart - &mms->uart[0]; - Chardev *uartchr = i < MAX_SERIAL_PORTS ? serial_hd(i) : NULL; int rxirqno = i * 2; int txirqno = i * 2 + 1; int combirqno = i + 10; @@ -182,7 +181,7 @@ static MemoryRegion *make_uart(MPS2TZMachineState *mms, void *opaque, init_sysbus_child(OBJECT(mms), name, uart, sizeof(mms->uart[0]), TYPE_CMSDK_APB_UART); - qdev_prop_set_chr(DEVICE(uart), "chardev", uartchr); + qdev_prop_set_chr(DEVICE(uart), "chardev", serial_hd(i)); qdev_prop_set_uint32(DEVICE(uart), "pclk-frq", SYSCLK_FRQ); object_property_set_bool(OBJECT(uart), true, "realized", &error_fatal); s = SYS_BUS_DEVICE(uart); |