Skip to contentSkip to conversation

mtd: rawnand: denali: add missed pci_release_regions

PATCH In review Chuhong Yuan 3 participants 3 messages Dec 6, 2019 – Jan 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: rawnand: denali: add missed pci_release_regions

The driver forgets to call pci_release_regions() in probe failure and remove.
Add the missed calls to fix it.

---
 drivers/mtd/nand/raw/denali_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/denali_pci.c +5 -1
index d62aa5271753..ca170775b141 100644
@@ -77,7 +77,8 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	denali->reg = ioremap_nocache(csr_base, csr_len);
 	if (!denali->reg) {
 		dev_err(&dev->dev, "Spectra: Unable to remap memory region\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto out_release_regions;
 	}
 
 	denali->host = ioremap_nocache(mem_base, mem_len);
@@ -121,6 +122,8 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	iounmap(denali->host);
 out_unmap_reg:
 	iounmap(denali->reg);
+out_release_regions:
+	pci_release_regions(dev);
 	return ret;
 }
 
@@ -131,6 +134,7 @@ static void denali_pci_remove(struct pci_dev *dev)
 	denali_remove(denali);
 	iounmap(denali->reg);
 	iounmap(denali->host);
+	pci_release_regions(dev);
 }
 
 static struct pci_driver denali_pci_driver = {
Signature · 1 line
2.24.0
#1 lore raw

Hi.

Quoted 7 lines · Chuhong Yuan

The driver forgets to call pci_release_regions() in probe failure and remove.
Add the missed calls to fix it.

---

This patch looks equivalent to what I submitted,
then was rejected a couple of years ago.
https://lists.gt.net/linux/kernel/2557740

Quoted 37 lines
 drivers/mtd/nand/raw/denali_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/denali_pci.c +5 -2
index d62aa5271753..ca170775b141 100644
@@ -77,7 +77,8 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        denali->reg = ioremap_nocache(csr_base, csr_len);
        if (!denali->reg) {
                dev_err(&dev->dev, "Spectra: Unable to remap memory region\n");
-               return -ENOMEM;
+               ret = -ENOMEM;
+               goto out_release_regions;
        }
 
        denali->host = ioremap_nocache(mem_base, mem_len);
@@ -121,6 +122,8 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        iounmap(denali->host);
 out_unmap_reg:
        iounmap(denali->reg);
+out_release_regions:
+       pci_release_regions(dev);
        return ret;
 }
 
@@ -131,6 +134,7 @@ static void denali_pci_remove(struct pci_dev *dev)
        denali_remove(denali);
        iounmap(denali->reg);
        iounmap(denali->host);
+       pci_release_regions(dev);
 }
 
 static struct pci_driver denali_pci_driver = {
--

2.24.0

Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer
#2 lore raw

Hi Masahiro,

Masahiro Yamada <[email protected]> wrote on Fri, 6 Dec 2019 19:32:03 +0900:

Quoted 8 lines

Hi.

Quoted 5 lines · Chuhong Yuan

The driver forgets to call pci_release_regions() in probe failure and remove.
Add the missed calls to fix it.

Quoted 6 lines
Quoted 2 lines

---

This patch looks equivalent to what I submitted,
then was rejected a couple of years ago.
https://lists.gt.net/linux/kernel/2557740

Thanks for the reminder, otherwise I would have applied it too.

Thanks,
Miquèl