From nobody Fri Sep 12 16:23:52 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEBA3C05027 for ; Wed, 8 Feb 2023 15:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbjBHPjJ (ORCPT ); Wed, 8 Feb 2023 10:39:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbjBHPjG (ORCPT ); Wed, 8 Feb 2023 10:39:06 -0500 Received: from smtpout01-ext2.partage.renater.fr (smtpout01-ext2.partage.renater.fr [194.254.240.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72E614615D for ; Wed, 8 Feb 2023 07:39:04 -0800 (PST) Received: from zmtaout01.partage.renater.fr (zmtaout01.partage.renater.fr [194.254.240.30]) by smtpout10.partage.renater.fr (Postfix) with ESMTP id B004664A14; Wed, 8 Feb 2023 16:38:55 +0100 (CET) Received: from zmtaout01.partage.renater.fr (localhost [127.0.0.1]) by zmtaout01.partage.renater.fr (Postfix) with ESMTPS id 40CCE1A0139; Wed, 8 Feb 2023 16:38:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zmtaout01.partage.renater.fr (Postfix) with ESMTP id 35B791A013B; Wed, 8 Feb 2023 16:38:55 +0100 (CET) Received: from zmtaout01.partage.renater.fr ([127.0.0.1]) by localhost (zmtaout01.partage.renater.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CWrDa3tUR0XS; Wed, 8 Feb 2023 16:38:55 +0100 (CET) Received: from zstore-b0-026.partage.renater.fr (zstore-b0-026.partage.renater.fr [10.254.240.112]) by zmtaout01.partage.renater.fr (Postfix) with ESMTP id EE91B1A0139; Wed, 8 Feb 2023 16:38:54 +0100 (CET) Date: Wed, 8 Feb 2023 16:38:54 +0100 (CET) From: Irvin Cote To: kbusch@kernel.org Cc: axboe@fb.com, hch@lst.de, sagi@grimberg.me, kch@nvidia.com, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Message-ID: <1517857586.68818728.1675870734911.JavaMail.zimbra@insa-lyon.fr> Subject: [PATCH] nvme-pci : rectifying the nvme_probe teardown path MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: Zimbra 8.8.15_GA_4372 (ZimbraWebClient - GC103 (Linux)/8.8.15_GA_4372) Thread-Index: fRAkiwxiQyLsYAI+MScOvhD1znFs/A== Thread-Topic: nvme-pci : rectifying the nvme_probe teardown path X-Virus-Scanned: clamav-milter 0.103.6 at clamav02 X-Virus-Status: Clean X-Renater-Ptge-SpamState: clean X-Renater-Ptge-SpamScore: 0 X-Renater-Ptge-SpamCause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehuddgudeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecutffgpfetvffgtfenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefkufggtgfgofhtsehtjegttdertdejnecuhfhrohhmpefkrhhvihhnucevohhtvgcuoehirhhvihhnrdgtohhtvgesihhnshgrqdhlhihonhdrfhhrqeenucggtffrrghtthgvrhhnpeeiuddtveeivdekhfekffetfeefieduudejueejteejffetveekhffftdekudehteenucfkphepuddtrddvheegrddvgedtrdduuddvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddtrddvheegrddvgedtrdduuddvpdhhvghlohepiihsthhorhgvqdgstddqtddviedrphgrrhhtrghgvgdrrhgvnhgrthgvrhdrfhhrpdhmrghilhhfrhhomhepkfhrvhhinhcuvehothgvuceoihhrvhhinhdrtghothgvsehinhhsrgdqlhihohhnrdhfrheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtohepkhgsuhhstghhsehkvghrnhgvlhdrohhrghdprhgtphhtthhopegrgigsohgvsehfsgdrtghomhdprhgtphhtthhopehhtghhsehlshhtrdguvgdprhgtphhtthhopehsrghgihesghhrihhmsggvrhhgrdhmvgdprhgtphhtthhopehktghhsehnvhhiughirgdrtghomhdprhgtphhtthhopehlihhnuhigqdhnvhhmvgeslhhishhtshdrihhnfhhrrgguvggrugdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From ced363dcd3ef076e509bfbb4ce9815ebaff6aee7 Mon Sep 17 00:00:00 2001 From: Irvin Cote 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. Fixes: eac3ef262941 ("nvme-pci: split the initial probe from the rest path") Signed-off-by: Irvin Cote --- drivers/nvme/host/pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c 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 =3D to_nvme_dev(ctrl); nvme_free_tagset(dev); + nvme_uninit_ctrl(ctrl); put_device(dev->dev); kfree(dev->queues); kfree(dev); @@ -3036,7 +3037,7 @@ static int nvme_probe(struct pci_dev *pdev, const str= uct pci_device_id *id) result =3D nvme_dev_map(dev); if (result) - goto out_uninit_ctrl; + goto out_unalloc_dev; result =3D nvme_setup_prp_pools(dev); if (result) @@ -3118,8 +3119,8 @@ static int nvme_probe(struct pci_dev *pdev, const str= uct pci_device_id *id) nvme_release_prp_pools(dev); out_dev_unmap: nvme_dev_unmap(dev); -out_uninit_ctrl: - nvme_uninit_ctrl(&dev->ctrl); +out_unalloc_dev: + nvme_pci_free_ctrl(&dev->ctrl); return result; } -- 2.37.2