From: Peng Wu <wupeng58@huawei.com> To: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>, <christophe.jaillet@wanadoo.fr> Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>, <liwei391@huawei.com>, <wupeng58@huawei.com> Subject: [PATCH v2] mtd: rawnand: cafe: fix drivers probe/remove methods Date: Fri, 20 May 2022 08:44:25 +0000 [thread overview] Message-ID: <20220520084425.116686-1-wupeng58@huawei.com> (raw) Driver should call pci_disable_device() if it returns from cafe_nand_probe() with error. Meanwhile, the driver calls pci_enable_device() in cafe_nand_probe(), but never calls pci_disable_device() during removal. Signed-off-by: Peng Wu <wupeng58@huawei.com> --- v2: - fix the subject prefix with "mtd: ranwnand: cafe:" --- drivers/mtd/nand/raw/cafe_nand.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c index 9dbf031716a6..af119e376352 100644 --- a/drivers/mtd/nand/raw/cafe_nand.c +++ b/drivers/mtd/nand/raw/cafe_nand.c @@ -679,8 +679,10 @@ static int cafe_nand_probe(struct pci_dev *pdev, pci_set_master(pdev); cafe = kzalloc(sizeof(*cafe), GFP_KERNEL); - if (!cafe) - return -ENOMEM; + if (!cafe) { + err = -ENOMEM; + goto out_disable_device; + } mtd = nand_to_mtd(&cafe->nand); mtd->dev.parent = &pdev->dev; @@ -801,6 +803,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, pci_iounmap(pdev, cafe->mmio); out_free_mtd: kfree(cafe); + out_disable_device: + pci_disable_device(pdev); out: return err; } @@ -822,6 +826,7 @@ static void cafe_nand_remove(struct pci_dev *pdev) pci_iounmap(pdev, cafe->mmio); dma_free_coherent(&cafe->pdev->dev, 2112, cafe->dmabuf, cafe->dmaaddr); kfree(cafe); + pci_disable_device(pdev); } static const struct pci_device_id cafe_nand_tbl[] = { -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Peng Wu <wupeng58@huawei.com> To: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>, <christophe.jaillet@wanadoo.fr> Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>, <liwei391@huawei.com>, <wupeng58@huawei.com> Subject: [PATCH v2] mtd: rawnand: cafe: fix drivers probe/remove methods Date: Fri, 20 May 2022 08:44:25 +0000 [thread overview] Message-ID: <20220520084425.116686-1-wupeng58@huawei.com> (raw) Driver should call pci_disable_device() if it returns from cafe_nand_probe() with error. Meanwhile, the driver calls pci_enable_device() in cafe_nand_probe(), but never calls pci_disable_device() during removal. Signed-off-by: Peng Wu <wupeng58@huawei.com> --- v2: - fix the subject prefix with "mtd: ranwnand: cafe:" --- drivers/mtd/nand/raw/cafe_nand.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c index 9dbf031716a6..af119e376352 100644 --- a/drivers/mtd/nand/raw/cafe_nand.c +++ b/drivers/mtd/nand/raw/cafe_nand.c @@ -679,8 +679,10 @@ static int cafe_nand_probe(struct pci_dev *pdev, pci_set_master(pdev); cafe = kzalloc(sizeof(*cafe), GFP_KERNEL); - if (!cafe) - return -ENOMEM; + if (!cafe) { + err = -ENOMEM; + goto out_disable_device; + } mtd = nand_to_mtd(&cafe->nand); mtd->dev.parent = &pdev->dev; @@ -801,6 +803,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, pci_iounmap(pdev, cafe->mmio); out_free_mtd: kfree(cafe); + out_disable_device: + pci_disable_device(pdev); out: return err; } @@ -822,6 +826,7 @@ static void cafe_nand_remove(struct pci_dev *pdev) pci_iounmap(pdev, cafe->mmio); dma_free_coherent(&cafe->pdev->dev, 2112, cafe->dmabuf, cafe->dmaaddr); kfree(cafe); + pci_disable_device(pdev); } static const struct pci_device_id cafe_nand_tbl[] = { -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2022-05-20 8:49 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-20 8:44 Peng Wu [this message] 2022-05-20 8:44 ` [PATCH v2] mtd: rawnand: cafe: fix drivers probe/remove methods Peng Wu 2022-05-20 16:53 ` Christophe JAILLET 2022-05-20 16:53 ` Christophe JAILLET 2022-05-20 17:09 ` Marion & Christophe JAILLET 2022-05-20 17:09 ` Marion & Christophe JAILLET 2022-06-09 12:44 ` Miquel Raynal 2022-06-09 12:44 ` Miquel Raynal
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=20220520084425.116686-1-wupeng58@huawei.com \ --to=wupeng58@huawei.com \ --cc=christophe.jaillet@wanadoo.fr \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=liwei391@huawei.com \ --cc=miquel.raynal@bootlin.com \ --cc=richard@nod.at \ --cc=stable@vger.kernel.org \ --cc=vigneshr@ti.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.