linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add missing call to 'pci_free_irq_vectors()'
@ 2021-02-14 13:21 Dejin Zheng
  2021-02-14 13:21 ` [PATCH 1/3] dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions Dejin Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dejin Zheng @ 2021-02-14 13:21 UTC (permalink / raw)
  To: gustavo.pimentel, vkoul, wangzhou1, ftoth, andy.shevchenko,
	qiuzhenfa, dmaengine
  Cc: linux-kernel, Dejin Zheng

This patchset just for add missing call to 'pci_free_irq_vectors()' in
the error handling path of the probe function, or in the remove function.

Dejin Zheng (3):
  dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe
    and remove functions
  dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in
    probe function
  dmaengine: hisilicon: Add missing call to 'pci_free_irq_vectors()' in
    probe function

 drivers/dma/dw-edma/dw-edma-pcie.c | 15 +++++++++++----
 drivers/dma/hisi_dma.c             | 14 ++++++++++----
 drivers/dma/hsu/pci.c              |  5 ++++-
 3 files changed, 25 insertions(+), 9 deletions(-)

-- 
2.25.0


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

* [PATCH 1/3] dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions
  2021-02-14 13:21 [PATCH 0/3] Add missing call to 'pci_free_irq_vectors()' Dejin Zheng
@ 2021-02-14 13:21 ` Dejin Zheng
  2021-02-15 13:25   ` Andy Shevchenko
  2021-02-14 13:21 ` [PATCH 2/3] dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in probe function Dejin Zheng
  2021-02-14 13:21 ` [PATCH 3/3] dmaengine: hisilicon: " Dejin Zheng
  2 siblings, 1 reply; 7+ messages in thread
From: Dejin Zheng @ 2021-02-14 13:21 UTC (permalink / raw)
  To: gustavo.pimentel, vkoul, wangzhou1, ftoth, andy.shevchenko,
	qiuzhenfa, dmaengine
  Cc: linux-kernel, Dejin Zheng

Call to 'pci_free_irq_vectors()' are missing both in the error handling
path of the probe function, and in the remove function.
Add them.

Fixes: e9bb8a9df316a2 ("dmaengine: hsu: pci: switch to new API for IRQ allocation")
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/dma/hsu/pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c
index 9045a6f7f589..b335e2ef795b 100644
--- a/drivers/dma/hsu/pci.c
+++ b/drivers/dma/hsu/pci.c
@@ -89,7 +89,7 @@ static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	ret = hsu_dma_probe(chip);
 	if (ret)
-		return ret;
+		goto err_irq_vectors;
 
 	ret = request_irq(chip->irq, hsu_pci_irq, 0, "hsu_dma_pci", chip);
 	if (ret)
@@ -112,6 +112,8 @@ static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 err_register_irq:
 	hsu_dma_remove(chip);
+err_irq_vectors:
+	pci_free_irq_vectors(pdev);
 	return ret;
 }
 
@@ -121,6 +123,7 @@ static void hsu_pci_remove(struct pci_dev *pdev)
 
 	free_irq(chip->irq, chip);
 	hsu_dma_remove(chip);
+	pci_free_irq_vectors(pdev);
 }
 
 static const struct pci_device_id hsu_pci_id_table[] = {
-- 
2.25.0


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

* [PATCH 2/3] dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in probe function
  2021-02-14 13:21 [PATCH 0/3] Add missing call to 'pci_free_irq_vectors()' Dejin Zheng
  2021-02-14 13:21 ` [PATCH 1/3] dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions Dejin Zheng
@ 2021-02-14 13:21 ` Dejin Zheng
  2021-02-15  9:45   ` Gustavo Pimentel
  2021-02-14 13:21 ` [PATCH 3/3] dmaengine: hisilicon: " Dejin Zheng
  2 siblings, 1 reply; 7+ messages in thread
From: Dejin Zheng @ 2021-02-14 13:21 UTC (permalink / raw)
  To: gustavo.pimentel, vkoul, wangzhou1, ftoth, andy.shevchenko,
	qiuzhenfa, dmaengine
  Cc: linux-kernel, Dejin Zheng

Call to 'pci_free_irq_vectors()' is missing in the error handling path
of the probe function, So add it.

Fixes: 41aaff2a2ac01c5 ("dmaengine: Add Synopsys eDMA IP PCIe glue-logic")
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/dma/dw-edma/dw-edma-pcie.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c
index 1eafc602e17e..c1e796bd3ee9 100644
--- a/drivers/dma/dw-edma/dw-edma-pcie.c
+++ b/drivers/dma/dw-edma/dw-edma-pcie.c
@@ -185,24 +185,31 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
 	/* Validating if PCI interrupts were enabled */
 	if (!pci_dev_msi_enabled(pdev)) {
 		pci_err(pdev, "enable interrupt failed\n");
-		return -EPERM;
+		err = -EPERM;
+		goto err_free_irq;
 	}
 
 	dw->irq = devm_kcalloc(dev, nr_irqs, sizeof(*dw->irq), GFP_KERNEL);
-	if (!dw->irq)
-		return -ENOMEM;
+	if (!dw->irq) {
+		err = -ENOMEM;
+		goto err_free_irq;
+	}
 
 	/* Starting eDMA driver */
 	err = dw_edma_probe(chip);
 	if (err) {
 		pci_err(pdev, "eDMA probe failed\n");
-		return err;
+		goto err_free_irq;
 	}
 
 	/* Saving data structure reference */
 	pci_set_drvdata(pdev, chip);
 
 	return 0;
+
+err_free_irq:
+	pci_free_irq_vectors(pdev);
+	return err;
 }
 
 static void dw_edma_pcie_remove(struct pci_dev *pdev)
-- 
2.25.0


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

* [PATCH 3/3] dmaengine: hisilicon: Add missing call to 'pci_free_irq_vectors()' in probe function
  2021-02-14 13:21 [PATCH 0/3] Add missing call to 'pci_free_irq_vectors()' Dejin Zheng
  2021-02-14 13:21 ` [PATCH 1/3] dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions Dejin Zheng
  2021-02-14 13:21 ` [PATCH 2/3] dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in probe function Dejin Zheng
@ 2021-02-14 13:21 ` Dejin Zheng
  2 siblings, 0 replies; 7+ messages in thread
From: Dejin Zheng @ 2021-02-14 13:21 UTC (permalink / raw)
  To: gustavo.pimentel, vkoul, wangzhou1, ftoth, andy.shevchenko,
	qiuzhenfa, dmaengine
  Cc: linux-kernel, Dejin Zheng

Call to 'pci_free_irq_vectors()' is missing in the error handling path
of the probe function, So add it.

Fixes: e9f08b65250d73ab ("dmaengine: hisilicon: Add Kunpeng DMA engine support")
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/dma/hisi_dma.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c
index a259ee010e9b..9e894d7f5dab 100644
--- a/drivers/dma/hisi_dma.c
+++ b/drivers/dma/hisi_dma.c
@@ -553,7 +553,7 @@ static int hisi_dma_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	ret = devm_add_action_or_reset(dev, hisi_dma_free_irq_vectors, pdev);
 	if (ret)
-		return ret;
+		goto err_free_irq;
 
 	dma_dev = &hdma_dev->dma_dev;
 	dma_cap_set(DMA_MEMCPY, dma_dev->cap_mask);
@@ -572,18 +572,24 @@ static int hisi_dma_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	ret = hisi_dma_enable_hw_channels(hdma_dev);
 	if (ret < 0) {
 		dev_err(dev, "failed to enable hw channel!\n");
-		return ret;
+		goto err_free_irq;
 	}
 
 	ret = devm_add_action_or_reset(dev, hisi_dma_disable_hw_channels,
 				       hdma_dev);
 	if (ret)
-		return ret;
+		goto err_free_irq;
 
 	ret = dmaenginem_async_device_register(dma_dev);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_err(dev, "failed to register device!\n");
+		goto err_free_irq;
+	}
+
+	return ret;
 
+err_free_irq:
+	pci_free_irq_vectors(pdev);
 	return ret;
 }
 
-- 
2.25.0


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

* RE: [PATCH 2/3] dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in probe function
  2021-02-14 13:21 ` [PATCH 2/3] dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in probe function Dejin Zheng
@ 2021-02-15  9:45   ` Gustavo Pimentel
  2021-02-15 12:46     ` Dejin Zheng
  0 siblings, 1 reply; 7+ messages in thread
From: Gustavo Pimentel @ 2021-02-15  9:45 UTC (permalink / raw)
  To: Dejin Zheng, vkoul, wangzhou1, ftoth, andy.shevchenko, qiuzhenfa,
	dmaengine
  Cc: linux-kernel

On Sun, Feb 14, 2021 at 13:21:52, Dejin Zheng <zhengdejin5@gmail.com> 
wrote:

> Call to 'pci_free_irq_vectors()' is missing in the error handling path
> of the probe function, So add it.
> 
> Fixes: 41aaff2a2ac01c5 ("dmaengine: Add Synopsys eDMA IP PCIe glue-logic")
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> ---
>  drivers/dma/dw-edma/dw-edma-pcie.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c
> index 1eafc602e17e..c1e796bd3ee9 100644
> --- a/drivers/dma/dw-edma/dw-edma-pcie.c
> +++ b/drivers/dma/dw-edma/dw-edma-pcie.c
> @@ -185,24 +185,31 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
>  	/* Validating if PCI interrupts were enabled */
>  	if (!pci_dev_msi_enabled(pdev)) {
>  		pci_err(pdev, "enable interrupt failed\n");
> -		return -EPERM;
> +		err = -EPERM;
> +		goto err_free_irq;
>  	}
>  
>  	dw->irq = devm_kcalloc(dev, nr_irqs, sizeof(*dw->irq), GFP_KERNEL);
> -	if (!dw->irq)
> -		return -ENOMEM;
> +	if (!dw->irq) {
> +		err = -ENOMEM;
> +		goto err_free_irq;
> +	}
>  
>  	/* Starting eDMA driver */
>  	err = dw_edma_probe(chip);
>  	if (err) {
>  		pci_err(pdev, "eDMA probe failed\n");
> -		return err;
> +		goto err_free_irq;
>  	}
>  
>  	/* Saving data structure reference */
>  	pci_set_drvdata(pdev, chip);
>  
>  	return 0;
> +
> +err_free_irq:
> +	pci_free_irq_vectors(pdev);
> +	return err;
>  }
>  
>  static void dw_edma_pcie_remove(struct pci_dev *pdev)
> -- 
> 2.25.0

Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>



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

* Re: [PATCH 2/3] dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in probe function
  2021-02-15  9:45   ` Gustavo Pimentel
@ 2021-02-15 12:46     ` Dejin Zheng
  0 siblings, 0 replies; 7+ messages in thread
From: Dejin Zheng @ 2021-02-15 12:46 UTC (permalink / raw)
  To: Gustavo Pimentel
  Cc: vkoul, wangzhou1, ftoth, andy.shevchenko, qiuzhenfa, dmaengine,
	linux-kernel

On Mon, Feb 15, 2021 at 09:45:07AM +0000, Gustavo Pimentel wrote:
> On Sun, Feb 14, 2021 at 13:21:52, Dejin Zheng <zhengdejin5@gmail.com> 
> wrote:
> 
> > Call to 'pci_free_irq_vectors()' is missing in the error handling path
> > of the probe function, So add it.
> > 
> > Fixes: 41aaff2a2ac01c5 ("dmaengine: Add Synopsys eDMA IP PCIe glue-logic")
> > Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> > ---
> >  drivers/dma/dw-edma/dw-edma-pcie.c | 15 +++++++++++----
> >  1 file changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c
> > index 1eafc602e17e..c1e796bd3ee9 100644
> > --- a/drivers/dma/dw-edma/dw-edma-pcie.c
> > +++ b/drivers/dma/dw-edma/dw-edma-pcie.c
> > @@ -185,24 +185,31 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
> >  	/* Validating if PCI interrupts were enabled */
> >  	if (!pci_dev_msi_enabled(pdev)) {
> >  		pci_err(pdev, "enable interrupt failed\n");
> > -		return -EPERM;
> > +		err = -EPERM;
> > +		goto err_free_irq;
> >  	}
> >  
> >  	dw->irq = devm_kcalloc(dev, nr_irqs, sizeof(*dw->irq), GFP_KERNEL);
> > -	if (!dw->irq)
> > -		return -ENOMEM;
> > +	if (!dw->irq) {
> > +		err = -ENOMEM;
> > +		goto err_free_irq;
> > +	}
> >  
> >  	/* Starting eDMA driver */
> >  	err = dw_edma_probe(chip);
> >  	if (err) {
> >  		pci_err(pdev, "eDMA probe failed\n");
> > -		return err;
> > +		goto err_free_irq;
> >  	}
> >  
> >  	/* Saving data structure reference */
> >  	pci_set_drvdata(pdev, chip);
> >  
> >  	return 0;
> > +
> > +err_free_irq:
> > +	pci_free_irq_vectors(pdev);
> > +	return err;
> >  }
> >  
> >  static void dw_edma_pcie_remove(struct pci_dev *pdev)
> > -- 
> > 2.25.0
> 
> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> 
>
Gustavo, Thanks!

Dejin

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

* Re: [PATCH 1/3] dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions
  2021-02-14 13:21 ` [PATCH 1/3] dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions Dejin Zheng
@ 2021-02-15 13:25   ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-02-15 13:25 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: Gustavo Pimentel, Vinod Koul, Zhou Wang, Ferry Toth, qiuzhenfa,
	dmaengine, Linux Kernel Mailing List

On Sun, Feb 14, 2021 at 3:22 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
>
> Call to 'pci_free_irq_vectors()' are missing both in the error handling
> path of the probe function, and in the remove function.
> Add them.

> Fixes: e9bb8a9df316a2 ("dmaengine: hsu: pci: switch to new API for IRQ allocation")

Same as per others. This does not fix anything, because there is no issue.
If you want to have it better, introduce a pcim_alloc_irq_vectors() to
show that it's managed.


-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2021-02-15 13:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 13:21 [PATCH 0/3] Add missing call to 'pci_free_irq_vectors()' Dejin Zheng
2021-02-14 13:21 ` [PATCH 1/3] dmaengine: hsu: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions Dejin Zheng
2021-02-15 13:25   ` Andy Shevchenko
2021-02-14 13:21 ` [PATCH 2/3] dmaengine: dw-edma: Add missing call to 'pci_free_irq_vectors()' in probe function Dejin Zheng
2021-02-15  9:45   ` Gustavo Pimentel
2021-02-15 12:46     ` Dejin Zheng
2021-02-14 13:21 ` [PATCH 3/3] dmaengine: hisilicon: " Dejin Zheng

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).