Skip to content

Commit 31eb07d

Browse files
tititiou36gregkh
authored andcommitted
mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
[ Upstream commit 6b430c7595e4eb95fae8fb54adc3c3ce002e75ae ] A successful 'init_rs_non_canonical()' call should be balanced by a corresponding 'free_rs()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: 8c61b7a ("[MTD] [NAND] Use rslib for CAFÉ ECC") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/fd313d3fb787458bcc73189e349f481133a2cdc9.1629532640.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 376e07a commit 31eb07d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/mtd/nand/cafe_nand.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
700700
"CAFE NAND", mtd);
701701
if (err) {
702702
dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq);
703-
goto out_ior;
703+
goto out_free_rs;
704704
}
705705

706706
/* Disable master reset, enable NAND clock */
@@ -808,6 +808,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
808808
/* Disable NAND IRQ in global IRQ mask register */
809809
cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
810810
free_irq(pdev->irq, mtd);
811+
out_free_rs:
812+
free_rs(cafe->rs);
811813
out_ior:
812814
pci_iounmap(pdev, cafe->mmio);
813815
out_free_mtd:

0 commit comments

Comments
 (0)