Hello Kenneth,

On 12/12/24 14:31, Kenneth Jia(贾纪东_华硕上海) wrote:
 From 24d3badbbb9dcc0d220609a7dd30f8da5002cba7 Mon Sep 17 00:00:00 2001

From: Kenneth Jia <kenneth_...@asus.com>

Date: Thu, 12 Dec 2024 20:42:04 +0800

Subject: [PATCH]    hw/arm/aspeed: fix connect_serial_hds_to_uarts

    In the loop, we need ignore the index increase when uart == uart_chosen

    We should increase the index only after we allocate a serial.

Signed-off-by: Kenneth Jia <kenneth_...@asus.com>

Could you please tell us a bit on your test environment ? I am interested
to know how you found the issue.

Also, please use "git send-email" to send patches.

Anyhow,

Fixes: d2b3eaefb4d7 ("aspeed: Refactor UART init for multi-SoC machines")
Reviewed-by: Cédric Le Goater <c...@redhat.com>

Thanks,

C.




---

hw/arm/aspeed.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c

index 556498f2a0..d8cb2d1429 100644

--- a/hw/arm/aspeed.c

+++ b/hw/arm/aspeed.c

@@ -364,11 +364,11 @@ static void 
connect_serial_hds_to_uarts(AspeedMachineState *bmc)

      int uart_chosen = bmc->uart_chosen ? bmc->uart_chosen : amc->uart_default;

      aspeed_soc_uart_set_chr(s, uart_chosen, serial_hd(0));

-    for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; i++, uart++) {

+    for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; uart++) {

          if (uart == uart_chosen) {

              continue;

          }

-        aspeed_soc_uart_set_chr(s, uart, serial_hd(i));

+        aspeed_soc_uart_set_chr(s, uart, serial_hd(i++));

      }

}

--

2.34.1



Reply via email to