Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Qing Wang <wangqing@vivo.com>
Subject: Re: [PATCH v1 1/1] serial: 8250_mid: Balance reference count for PCI DMA device
Date: Tue, 15 Feb 2022 11:11:41 +0100	[thread overview]
Message-ID: <db576c63-73e2-b5f8-bc8b-057bdab2264d@kernel.org> (raw)
In-Reply-To: <20220215100920.41984-1-andriy.shevchenko@linux.intel.com>

On 15. 02. 22, 11:09, Andy Shevchenko wrote:
> The pci_get_slot() increases its reference count, the caller
> must decrement the reference count by calling pci_dev_put().

And what about the -EINVAL case?

> Fixes: 90b9aacf912a ("serial: 8250_pci: add Intel Tangier support")
> Fixes: f549e94effa1 ("serial: 8250_pci: add Intel Penwell ports")
> Depends-on: d9eda9bab237 ("serial: 8250_pci: Intel MID UART support to its own driver")
> Reported-by: Qing Wang <wangqing@vivo.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/tty/serial/8250/8250_mid.c | 19 +++++++++++++++----
>   1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c
> index efa0515139f8..e6c1791609dd 100644
> --- a/drivers/tty/serial/8250/8250_mid.c
> +++ b/drivers/tty/serial/8250/8250_mid.c
> @@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p)
>   	return 0;
>   }
>   
> +static void pnw_exit(struct mid8250 *mid)
> +{
> +	pci_dev_put(mid->dma_dev);
> +}
> +
>   static int tng_handle_irq(struct uart_port *p)
>   {
>   	struct mid8250 *mid = p->private_data;
> @@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p)
>   	return 0;
>   }
>   
> +static void tng_exit(struct mid8250 *mid)
> +{
> +	pci_dev_put(mid->dma_dev);
> +}
> +
>   static int dnv_handle_irq(struct uart_port *p)
>   {
>   	struct mid8250 *mid = p->private_data;
> @@ -330,9 +340,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   
>   	pci_set_drvdata(pdev, mid);
>   	return 0;
> +
>   err:
> -	if (mid->board->exit)
> -		mid->board->exit(mid);
> +	mid->board->exit(mid);
>   	return ret;
>   }
>   
> @@ -342,8 +352,7 @@ static void mid8250_remove(struct pci_dev *pdev)
>   
>   	serial8250_unregister_port(mid->line);
>   
> -	if (mid->board->exit)
> -		mid->board->exit(mid);
> +	mid->board->exit(mid);
>   }
>   
>   static const struct mid8250_board pnw_board = {
> @@ -351,6 +360,7 @@ static const struct mid8250_board pnw_board = {
>   	.freq = 50000000,
>   	.base_baud = 115200,
>   	.setup = pnw_setup,
> +	.exit = pnw_exit,
>   };
>   
>   static const struct mid8250_board tng_board = {
> @@ -358,6 +368,7 @@ static const struct mid8250_board tng_board = {
>   	.freq = 38400000,
>   	.base_baud = 1843200,
>   	.setup = tng_setup,
> +	.exit = tng_exit,
>   };
>   
>   static const struct mid8250_board dnv_board = {


-- 
js
suse labs

  reply	other threads:[~2022-02-15 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 10:09 [PATCH v1 1/1] serial: 8250_mid: Balance reference count for PCI DMA device Andy Shevchenko
2022-02-15 10:11 ` Jiri Slaby [this message]
2022-02-15 10:29   ` Andy Shevchenko
2022-02-15 10:31     ` Andy Shevchenko
2022-02-15 11:08       ` Jiri Slaby
2022-02-15 12:25         ` Andy Shevchenko
2022-02-15 12:26           ` 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=db576c63-73e2-b5f8-bc8b-057bdab2264d@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=wangqing@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