Re: [PATCH] serial: 8250_pcilib: Replace deprecated PCI functions
From: Jiri Slaby
Date: Mon Sep 29 2025 - 02:00:24 EST
On 26. 09. 25, 14:31, Florian Eckert wrote:
Signed-off-by: Florian Eckert <fe@xxxxxxxxxx>...
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -165,7 +165,15 @@ static int
setup_port(struct serial_private *priv, struct uart_8250_port *port,
u8 bar, unsigned int offset, int regshift)
{
- return serial8250_pci_setup_port(priv->dev, port, bar, offset, regshift);
+ void __iomem *iomem = NULL;
+
+ if (pci_resource_flags(priv->dev, bar) & IORESOURCE_MEM) {
+ iomem = pcim_iomap(priv->dev, bar, 0);
+ if (IS_ERR(iomem))
+ return -ENOMEM;
Why not to propagate the error?
Most other calls in the kernel of this function return
-ENOMEM on error. Therefore, I thought that this is the
correct return value. I can fix that in v2 if you like.
Let me know what you prefer.
Ugh, pcim_iomap() returns NULL on error, so the IS_ERR() check is all wrong. What other places in the kernel use IS_ERR()? They need fixing.
thanks,
--
js
suse labs