linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Utkarsh Verma <utkarshverma294@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	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>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-kernel-mentees@lists.linuxfoundation.org,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH] serial: 8250_exar: Add missing call to pci_free_irq_vectors()
Date: Tue, 17 Aug 2021 20:31:30 +0300	[thread overview]
Message-ID: <CAHp75Vc49M-bdRviytZojK8+vMWJPXA_7zmLx3EvyQNXh8veZA@mail.gmail.com> (raw)
In-Reply-To: <20210817170057.16783-1-utkarshverma294@gmail.com>

On Tue, Aug 17, 2021 at 8:05 PM Utkarsh Verma <utkarshverma294@gmail.com> wrote:
>
> Free the pci irq vectors if the call to pci_alloc_irq_vectors() fails
> or if the device is removed.

+Cc: Bjorn

This patch adds no value for all the code. This needs simply better
semantics on allocations (because freeing is happening here
implicitly).
Bjorn, this is an exact example why we need pcim_alloc_irq_vectors().

> 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);
>  }


-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-08-17 17:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 17:00 [PATCH] serial: 8250_exar: Add missing call to pci_free_irq_vectors() Utkarsh Verma
2021-08-17 17:31 ` Andy Shevchenko [this message]
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=CAHp75Vc49M-bdRviytZojK8+vMWJPXA_7zmLx3EvyQNXh8veZA@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bhelgaas@google.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=utkarshverma294@gmail.com \
    --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).