From: Florian Eckert <fe@dev.tdt.de>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: gregkh@linuxfoundation.org, kumaravel.thiagarajan@microchip.com,
andriy.shevchenko@linux.intel.com, pnewman@connecttech.com,
angelogioacchino.delregno@collabora.com, peterz@infradead.org,
yujiaoliang@vivo.com, arnd@kernel.org, cang1@live.co.uk,
macro@orcam.me.uk, schnelle@linux.ibm.com,
Eckert.Florian@googlemail.com, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: 8250_pcilib: Replace deprecated PCI functions
Date: Mon, 29 Sep 2025 08:33:10 +0200 [thread overview]
Message-ID: <cd5e677afaefb5ffa48913f4b6aa1efb@dev.tdt.de> (raw)
In-Reply-To: <da2de297-2c9c-4855-9fb7-553022538cde@kernel.org>
On 2025-09-29 08:00, Jiri Slaby wrote:
> On 26. 09. 25, 14:31, Florian Eckert wrote:
>>>> Signed-off-by: Florian Eckert <fe@dev.tdt.de>
>>> ...
>>>> --- 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.
You're right. The function returns a pointer here and my check IS_ERR()
is wrong. I mixed it up with the 'pcim_iomap_region()' function.
Because I wanted to use this function before. As far as I can see, the
return
value of 'pcim_iomap()' is checked correctly in the linux sources.
Sorry for the noise.
I will adjust this and send a V2 patch.
--
Florian
prev parent reply other threads:[~2025-09-29 6:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 13:35 [PATCH] serial: 8250_pcilib: Replace deprecated PCI functions Florian Eckert
2025-09-26 8:29 ` Jiri Slaby
2025-09-26 12:31 ` Florian Eckert
2025-09-29 6:00 ` Jiri Slaby
2025-09-29 6:33 ` Florian Eckert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd5e677afaefb5ffa48913f4b6aa1efb@dev.tdt.de \
--to=fe@dev.tdt.de \
--cc=Eckert.Florian@googlemail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arnd@kernel.org \
--cc=cang1@live.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kumaravel.thiagarajan@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=peterz@infradead.org \
--cc=pnewman@connecttech.com \
--cc=schnelle@linux.ibm.com \
--cc=yujiaoliang@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).