This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 37cdbb971e15e4e81334a2e857eda1055668dd95 Author: Brijesh Thakkar <[email protected]> AuthorDate: Thu Oct 22 18:02:23 2026 +0530 drivers/serial/uart_pci_16550: Compute port address from the BAR base The probe loop does "base += type->portincr * port", which accumulates across iterations instead of using the BAR base. For a card with a non-zero port increment the third and fourth ports get offsets 24 and 48 instead of 16 and 24 (with a port increment of 8). Compute each port address as the BAR base plus portincr * port. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Brijesh Thakkar <[email protected]> --- drivers/serial/uart_pci_16550.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/serial/uart_pci_16550.c b/drivers/serial/uart_pci_16550.c index 8f493d65a98..352c52679da 100644 --- a/drivers/serial/uart_pci_16550.c +++ b/drivers/serial/uart_pci_16550.c @@ -666,6 +666,7 @@ static int pci_u16550_probe(FAR struct pci_device_s *dev) FAR uart_dev_t *udev = NULL; FAR struct pci_u16550_priv_s *priv = NULL; uintptr_t base = 0; + uintptr_t portbase; size_t i; uint8_t port; uint8_t ports; @@ -714,7 +715,7 @@ static int pci_u16550_probe(FAR struct pci_device_s *dev) { /* Get port address */ - base += type->portincr * port; + portbase = base + type->portincr * port; /* Take the instance that matches the configuration */ @@ -753,7 +754,7 @@ static int pci_u16550_probe(FAR struct pci_device_s *dev) /* Initialize device */ - ret = pci_u16550_initialize(priv, type, base, dev, mmio); + ret = pci_u16550_initialize(priv, type, portbase, dev, mmio); if (ret < 0) { return ret;
