public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Daniel Stodden <dns@arista.com>
Cc: Kurt Schwemmer <kurt.schwemmer@microsemi.com>,
	Logan Gunthorpe <logang@deltatee.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: switchtec: Fix an error handling path in switchtec_pci_probe()
Date: Thu, 28 Dec 2023 17:56:26 -0600	[thread overview]
Message-ID: <20231228235626.GA1559849@bhelgaas> (raw)
In-Reply-To: <01446d2ccb91a578239915812f2b7dfbeb2882af.1703428183.git.christophe.jaillet@wanadoo.fr>

[+to Daniel, can you take a look?  If you like this, I'd like to
squash it into df25461119d9 and credit Christophe since that's not
upstream yet]

On Sun, Dec 24, 2023 at 03:30:01PM +0100, Christophe JAILLET wrote:
> The commit in Fixes changed the logic on how resources are released and
> introduced a new switchtec_exit_pci() that need to be called explicitly in
> order to undo a corresponding switchtec_init_pci().
> 
> This was done in the remove function, but not in the probe.
> 
> Fix the probe now.
> 
> Fixes: df25461119d9 ("PCI: switchtec: Fix stdev_release() crash after surprise hot remove")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/pci/switch/switchtec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
> index 1804794d0e68..5a4adf6c04cf 100644
> --- a/drivers/pci/switch/switchtec.c
> +++ b/drivers/pci/switch/switchtec.c
> @@ -1672,7 +1672,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
>  	rc = switchtec_init_isr(stdev);
>  	if (rc) {
>  		dev_err(&stdev->dev, "failed to init isr.\n");
> -		goto err_put;
> +		goto err_exit_pci;
>  	}
>  
>  	iowrite32(SWITCHTEC_EVENT_CLEAR |
> @@ -1693,6 +1693,8 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
>  
>  err_devadd:
>  	stdev_kill(stdev);
> +err_exit_pci:
> +	switchtec_exit_pci(stdev);
>  err_put:
>  	ida_free(&switchtec_minor_ida, MINOR(stdev->dev.devt));
>  	put_device(&stdev->dev);
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-12-28 23:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-24 14:30 [PATCH] PCI: switchtec: Fix an error handling path in switchtec_pci_probe() Christophe JAILLET
2023-12-28 23:56 ` Bjorn Helgaas [this message]
2023-12-29  1:39   ` Daniel Stodden
2024-02-08 21:36 ` Bjorn Helgaas

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=20231228235626.GA1559849@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=0x7f454c46@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dns@arista.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kurt.schwemmer@microsemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=logang@deltatee.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