From: Utkarsh Verma <utkarshverma294@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Valmer Huhn <valmer.huhn@concurrent-rt.com>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
Utkarsh Verma <utkarshverma294@gmail.com>
Subject: [PATCH] serial: 8250_exar: Add missing call to pci_free_irq_vectors()
Date: Tue, 17 Aug 2021 22:30:57 +0530 [thread overview]
Message-ID: <20210817170057.16783-1-utkarshverma294@gmail.com> (raw)
Free the pci irq vectors if the call to pci_alloc_irq_vectors() fails
or if the device is removed.
Signed-off-by: Utkarsh Verma <utkarshverma294@gmail.com>
---
drivers/tty/serial/8250/8250_exar.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index 3ffeedc29c83..38b65d6980f5 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -627,8 +627,10 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
pci_set_master(pcidev);
rc = pci_alloc_irq_vectors(pcidev, 1, 1, PCI_IRQ_ALL_TYPES);
- if (rc < 0)
+ if (rc < 0) {
+ pci_free_irq_vectors(pcidev);
return rc;
+ }
memset(&uart, 0, sizeof(uart));
uart.port.flags = UPF_SHARE_IRQ | UPF_EXAR_EFR | UPF_FIXED_TYPE | UPF_FIXED_PORT;
@@ -677,6 +679,7 @@ static void exar_pci_remove(struct pci_dev *pcidev)
if (priv->board->exit)
priv->board->exit(pcidev);
+ pci_free_irq_vectors(pcidev);
}
static int __maybe_unused exar_suspend(struct device *dev)
--
2.17.1
next reply other threads:[~2021-08-17 17:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 17:00 Utkarsh Verma [this message]
2021-08-17 17:31 ` [PATCH] serial: 8250_exar: Add missing call to pci_free_irq_vectors() Andy Shevchenko
2021-08-17 17:38 ` Andy Shevchenko
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=20210817170057.16783-1-utkarshverma294@gmail.com \
--to=utkarshverma294@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=valmer.huhn@concurrent-rt.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).