From: Bjorn Helgaas <helgaas@kernel.org>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: bhelgaas@google.com, tglx@linutronix.de, jgross@suse.com,
hans.zhang@cixtech.com, himanshu.madhani@oracle.com,
roger.pau@citrix.com, chrisl@kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI/MSI: add iounmap in msix_capability_init()
Date: Fri, 6 Feb 2026 16:37:39 -0600 [thread overview]
Message-ID: <20260206223739.GA99172@bhelgaas> (raw)
In-Reply-To: <20260125144452.2103812-1-lihaoxiang@isrc.iscas.ac.cn>
On Sun, Jan 25, 2026 at 10:44:52PM +0800, Haoxiang Li wrote:
> In msix_capability_init(), if msix_setup_interrupts()
> fails, call iounmap() to release the memory allocated
> by msix_map_region().
>
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
> drivers/pci/msi/msi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> index 34d664139f48..e010ecd9f90d 100644
> --- a/drivers/pci/msi/msi.c
> +++ b/drivers/pci/msi/msi.c
> @@ -737,7 +737,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
>
> ret = msix_setup_interrupts(dev, entries, nvec, affd);
> if (ret)
> - goto out_disable;
> + goto out_unmap;
>
> /* Disable INTX */
> pci_intx_for_msi(dev, 0);
> @@ -758,6 +758,8 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
> pcibios_free_irq(dev);
> return 0;
>
> +out_unmap:
> + iounmap(dev->msix_base);
Maybe Thomas has already applied this, and if not, he should chime in.
Personally, I would prefer if msix_map_region() were renamed and made
to return the phys_addr instead of returning the ioremapped address.
That way both the ioremap() and the iounmap() on failure would be in
msix_capability_init() so it's easier to review.
> out_disable:
> dev->msix_enabled = 0;
> pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE, 0);
> --
> 2.25.1
>
next prev parent reply other threads:[~2026-02-06 22:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-25 14:44 [PATCH] PCI/MSI: add iounmap in msix_capability_init() Haoxiang Li
2026-02-06 22:37 ` Bjorn Helgaas [this message]
2026-03-10 14:38 ` Guenter Roeck
2026-03-16 17:22 ` Guenter Roeck
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=20260206223739.GA99172@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=chrisl@kernel.org \
--cc=hans.zhang@cixtech.com \
--cc=himanshu.madhani@oracle.com \
--cc=jgross@suse.com \
--cc=lihaoxiang@isrc.iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=roger.pau@citrix.com \
--cc=tglx@linutronix.de \
/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