[PATCH v2 2/2] serial: 8250_lpss: Switch to pcim_iomap() instead of pci_ioremap_bar()

From: Andy Shevchenko
Date: Tue Feb 15 2022 - 08:43:53 EST


The pci_iounmap() doesn't cover all the cases where resource should
be unmapped. Instead of spreading it more, replace the pci_ioremap_bar()
with pcim_iomap() which uses managed resource approach.

Fixes: fecdef932b00 ("serial: 8250_lpss: enable DMA on Intel Quark UART")
Depends-on: ea5ab2e422de ("8250_lpss: check null return when calling pci_ioremap_bar")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
v2: new fix (by code inspection due to previous patch)
drivers/tty/serial/8250/8250_lpss.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
index 0f5af061e0b4..a9fc1d7d9c37 100644
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -209,7 +209,7 @@ static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port)
chip->dev = &pdev->dev;
chip->id = pdev->devfn;
chip->irq = pci_irq_vector(pdev, 0);
- chip->regs = pci_ioremap_bar(pdev, 1);
+ chip->regs = pcim_iomap(pdev, 1, 0);
if (!chip->regs)
return;

@@ -241,8 +241,6 @@ static void qrk_serial_exit_dma(struct lpss8250 *lpss)
return;

dw_dma_remove(chip);
-
- pci_iounmap(to_pci_dev(chip->dev), chip->regs);
}
#else /* CONFIG_SERIAL_8250_DMA */
static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port) {}
--
2.34.1