Skip to content

Commit d43b24f

Browse files
Chen Ridongmiquelraynal
authored andcommitted
mtd: rawnand: denali: Fix missing pci_release_regions in probe and remove
The pci_release_regions was miss at error case, just add it. Signed-off-by: Chen Ridong <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent ccce710 commit d43b24f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/mtd/nand/raw/denali_pci.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,20 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
7777
denali->reg = devm_ioremap(denali->dev, csr_base, csr_len);
7878
if (!denali->reg) {
7979
dev_err(&dev->dev, "Spectra: Unable to remap memory region\n");
80-
return -ENOMEM;
80+
ret = -ENOMEM;
81+
goto regions_release;
8182
}
8283

8384
denali->host = devm_ioremap(denali->dev, mem_base, mem_len);
8485
if (!denali->host) {
8586
dev_err(&dev->dev, "Spectra: ioremap failed!");
86-
return -ENOMEM;
87+
ret = -ENOMEM;
88+
goto regions_release;
8789
}
8890

8991
ret = denali_init(denali);
9092
if (ret)
91-
return ret;
93+
goto regions_release;
9294

9395
nsels = denali->nbanks;
9496

@@ -116,13 +118,16 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
116118

117119
out_remove_denali:
118120
denali_remove(denali);
121+
regions_release:
122+
pci_release_regions(dev);
119123
return ret;
120124
}
121125

122126
static void denali_pci_remove(struct pci_dev *dev)
123127
{
124128
struct denali_controller *denali = pci_get_drvdata(dev);
125129

130+
pci_release_regions(dev);
126131
denali_remove(denali);
127132
}
128133

0 commit comments

Comments
 (0)