mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "GONG, Ruiqi" <gongruiqi1@huawei.com>
Cc: Jiri Slaby <jirislaby@kernel.org>,
	linux-kernel@vger.kernel.org, wangweiyang2@huawei.com
Subject: Re: [PATCH] tty: moxa: Refine error handling in moxa_pci_probe
Date: Mon, 1 Aug 2022 11:01:42 +0200	[thread overview]
Message-ID: <YueWdjtxvmmZAA9E@kroah.com> (raw)
In-Reply-To: <20220801085356.1716756-1-gongruiqi1@huawei.com>

On Mon, Aug 01, 2022 at 04:53:56PM +0800, GONG, Ruiqi wrote:
> Add pci_disable_device() into the error handling, and therefore make the
> function not jump to err if pci_enable_device() failed.
> 
> Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>
> ---
>  drivers/tty/moxa.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
> index f3c72ab1476c..4432a39331d3 100644
> --- a/drivers/tty/moxa.c
> +++ b/drivers/tty/moxa.c
> @@ -1239,7 +1239,7 @@ static int moxa_pci_probe(struct pci_dev *pdev,
>  	retval = pci_enable_device(pdev);
>  	if (retval) {
>  		dev_err(&pdev->dev, "can't enable pci device\n");
> -		goto err;
> +		return retval;
>  	}
>  
>  	for (i = 0; i < MAX_BOARDS; i++)
> @@ -1300,6 +1300,7 @@ static int moxa_pci_probe(struct pci_dev *pdev,
>  err_reg:
>  	pci_release_region(pdev, 2);
>  err:
> +	pci_disable_device(pdev);

Are you sure you want to do this?  What happens if this is a
multi-function device, you just turned it off, right?

How did you test this change?  Do you have the hardware for it?

thanks,

greg k-h

      reply	other threads:[~2022-08-01  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01  8:53 GONG, Ruiqi
2022-08-01  9:01 ` Greg Kroah-Hartman [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=YueWdjtxvmmZAA9E@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=gongruiqi1@huawei.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangweiyang2@huawei.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

Powered by JetHome