Re: [PATCH] mtd: nand: denali_pci: add missing pci_release_regions() calls

From: Boris Brezillon
Date: Mon Nov 07 2016 - 08:52:50 EST


On Mon, 07 Nov 2016 15:33:04 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> On Thu, 2016-11-03 at 02:13 +0900, Masahiro Yamada wrote:
> > The probe function calls pci_request_regions(), but I do not see
> > corresponding pci_release_regions() calls.
> >
> > While we are here, rename the jump labels to follow the guideline
> > "Choose label names which say what the goto does" suggested by
> > Documentation/CodingStyle.
>
> NACK!
>
> Please, remove or revert this patch.
> Everything is done in pcim_release() function.

Indeed. I'll drop the patch.

Thanks,

Boris

>
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
> > ---
> >
> > Âdrivers/mtd/nand/denali_pci.c | 14 +++++++++-----
> > Â1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/denali_pci.c
> > b/drivers/mtd/nand/denali_pci.c
> > index de31514..be8152f 100644
> > --- a/drivers/mtd/nand/denali_pci.c
> > +++ b/drivers/mtd/nand/denali_pci.c
> > @@ -76,28 +76,31 @@ static int denali_pci_probe(struct pci_dev *dev,
> > const struct pci_device_id *id)
> > Â denali->flash_reg = ioremap_nocache(csr_base, csr_len);
> > Â if (!denali->flash_reg) {
> > Â dev_err(&dev->dev, "Spectra: Unable to remap memory
> > region\n");
> > - return -ENOMEM;
> > + ret = -ENOMEM;
> > + goto release_regions;
> > Â }
> > Â
> > Â denali->flash_mem = ioremap_nocache(mem_base, mem_len);
> > Â if (!denali->flash_mem) {
> > Â dev_err(&dev->dev, "Spectra: ioremap_nocache
> > failed!");
> > Â ret = -ENOMEM;
> > - goto failed_remap_reg;
> > + goto unmap_reg;
> > Â }
> > Â
> > Â ret = denali_init(denali);
> > Â if (ret)
> > - goto failed_remap_mem;
> > + goto unmap_mem;
> > Â
> > Â pci_set_drvdata(dev, denali);
> > Â
> > Â return 0;
> > Â
> > -failed_remap_mem:
> > +unmap_mem:
> > Â iounmap(denali->flash_mem);
> > -failed_remap_reg:
> > +unmap_reg:
> > Â iounmap(denali->flash_reg);
> > +release_regions:
> > + pci_release_regions(dev);
> > Â return ret;
> > Â}
> > Â
> > @@ -109,6 +112,7 @@ static void denali_pci_remove(struct pci_dev *dev)
> > Â denali_remove(denali);
> > Â iounmap(denali->flash_reg);
> > Â iounmap(denali->flash_mem);
> > + pci_release_regions(dev);
> > Â}
> > Â
> > Âstatic struct pci_driver denali_pci_driver = {
>