public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Irvin Cote <irvin.cote@insa-lyon.fr>
Cc: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me,
	kch@nvidia.com, linux-nvme@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvme-pci : rectifying the nvme_probe teardown path
Date: Thu, 9 Feb 2023 06:17:45 +0100	[thread overview]
Message-ID: <20230209051745.GA8420@lst.de> (raw)
In-Reply-To: <1517857586.68818728.1675870734911.JavaMail.zimbra@insa-lyon.fr>

On Wed, Feb 08, 2023 at 04:38:54PM +0100, Irvin Cote wrote:
> >From ced363dcd3ef076e509bfbb4ce9815ebaff6aee7 Mon Sep 17 00:00:00 2001
> From: Irvin Cote <irvin.cote@insa-lyon.fr>
> Date: Wed, 8 Feb 2023 11:38:39 -0300
> Subject: [PATCH] nvme-pci : rectifying the nvme_probe teardown path
> The nvme_probe teardown path did not account for
> undoing the work of nvme_pci_alloc_dev, which is
> what nvme_pci_free_ctrl seemed to be intended for.
> Thus I displaced the call to nvme_uninit_ctrl
> from nvme_probe to nvme_pci_free_ctrl and added
> a call to the latter in the teardown path of nvme_probe.

Can you explain the problems you are seeing?

> index c734934c407c..db480bc64c7b 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2731,6 +2731,7 @@ static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl)
>  	struct nvme_dev *dev = to_nvme_dev(ctrl);
> 
>  	nvme_free_tagset(dev);
> +	nvme_uninit_ctrl(ctrl);

->free_ctrl is called for the final put of the ctrl, calling
nvme_uninit_ctrl here does not make sense.

> -out_uninit_ctrl:
> -	nvme_uninit_ctrl(&dev->ctrl);
> +out_unalloc_dev:
> +	nvme_pci_free_ctrl(&dev->ctrl);

Also calling nvme_pci_free_ctrl directly and not through the method
table is also wrong.

      reply	other threads:[~2023-02-09  5:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 15:38 [PATCH] nvme-pci : rectifying the nvme_probe teardown path Irvin Cote
2023-02-09  5:17 ` Christoph Hellwig [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=20230209051745.GA8420@lst.de \
    --to=hch@lst.de \
    --cc=axboe@fb.com \
    --cc=irvin.cote@insa-lyon.fr \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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