linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: denali: add missed pci_release_regions
@ 2019-12-06  7:54 Chuhong Yuan
  2019-12-06 10:32 ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Chuhong Yuan @ 2019-12-06  7:54 UTC (permalink / raw)
  Cc: Masahiro Yamada, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd, linux-kernel, Chuhong Yuan

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

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/mtd/nand/raw/denali_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/denali_pci.c b/drivers/mtd/nand/raw/denali_pci.c
index d62aa5271753..ca170775b141 100644
--- a/drivers/mtd/nand/raw/denali_pci.c
+++ b/drivers/mtd/nand/raw/denali_pci.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: rawnand: denali: add missed pci_release_regions
  2019-12-06  7:54 [PATCH] mtd: rawnand: denali: add missed pci_release_regions Chuhong Yuan
@ 2019-12-06 10:32 ` Masahiro Yamada
  2020-01-09 15:53   ` Miquel Raynal
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2019-12-06 10:32 UTC (permalink / raw)
  To: Chuhong Yuan
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	linux-mtd, Linux Kernel Mailing List

Hi.

On Fri, Dec 6, 2019 at 4:54 PM Chuhong Yuan <hslester96@gmail.com> wrote:
>
> The driver forgets to call pci_release_regions() in probe failure
> and remove.
> Add the missed calls to fix it.
>
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---

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



>  drivers/mtd/nand/raw/denali_pci.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/denali_pci.c b/drivers/mtd/nand/raw/denali_pci.c
> index d62aa5271753..ca170775b141 100644
> --- a/drivers/mtd/nand/raw/denali_pci.c
> +++ b/drivers/mtd/nand/raw/denali_pci.c
> @@ -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
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: rawnand: denali: add missed pci_release_regions
  2019-12-06 10:32 ` Masahiro Yamada
@ 2020-01-09 15:53   ` Miquel Raynal
  0 siblings, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2020-01-09 15:53 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Chuhong Yuan, Richard Weinberger, Vignesh Raghavendra, linux-mtd,
	Linux Kernel Mailing List

Hi Masahiro,

Masahiro Yamada <masahiroy@kernel.org> wrote on Fri, 6 Dec 2019
19:32:03 +0900:

> Hi.
> 
> On Fri, Dec 6, 2019 at 4:54 PM Chuhong Yuan <hslester96@gmail.com> wrote:
> >
> > The driver forgets to call pci_release_regions() in probe failure
> > and remove.
> > Add the missed calls to fix it.
> >
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > ---  
> 
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-09 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06  7:54 [PATCH] mtd: rawnand: denali: add missed pci_release_regions Chuhong Yuan
2019-12-06 10:32 ` Masahiro Yamada
2020-01-09 15:53   ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).