Skip to content

Commit 6b430c7

Browse files
tititiou36miquelraynal
authored andcommitted
mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/fd313d3fb787458bcc73189e349f481133a2cdc9.1629532640.git.christophe.jaillet@wanadoo.fr
1 parent 0792ec8 commit 6b430c7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/mtd/nand/raw/cafe_nand.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
751751
"CAFE NAND", mtd);
752752
if (err) {
753753
dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq);
754-
goto out_ior;
754+
goto out_free_rs;
755755
}
756756

757757
/* Disable master reset, enable NAND clock */
@@ -795,6 +795,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
795795
/* Disable NAND IRQ in global IRQ mask register */
796796
cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
797797
free_irq(pdev->irq, mtd);
798+
out_free_rs:
799+
free_rs(cafe->rs);
798800
out_ior:
799801
pci_iounmap(pdev, cafe->mmio);
800802
out_free_mtd:

0 commit comments

Comments
 (0)