linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: thunderx: Fix an issue about missing call to 'pci_free_irq_vectors()'
@ 2021-02-14 14:37 Dejin Zheng
  2021-02-18  9:29 ` Robert Richter
  2021-02-18  9:45 ` Robert Richter
  0 siblings, 2 replies; 3+ messages in thread
From: Dejin Zheng @ 2021-02-14 14:37 UTC (permalink / raw)
  To: rric, wsa+renesas, jan.glauber, linux-i2c; +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. So add them.

Fixes: 4c21541d8da17fb ("i2c: thunderx: Replace pci_enable_msix()")
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/i2c/busses/i2c-thunderx-pcidrv.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index 12c90aa0900e..6a338be4d4b7 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -199,11 +199,11 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev,
 	ret = devm_request_irq(dev, pci_irq_vector(pdev, 0), octeon_i2c_isr, 0,
 			       DRV_NAME, i2c);
 	if (ret)
-		goto error;
+		goto error_free_irq;
 
 	ret = octeon_i2c_init_lowlevel(i2c);
 	if (ret)
-		goto error;
+		goto error_free_irq;
 
 	octeon_i2c_set_clock(i2c);
 
@@ -219,7 +219,7 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev,
 
 	ret = i2c_add_adapter(&i2c->adap);
 	if (ret)
-		goto error;
+		goto error_free_irq;
 
 	dev_info(i2c->dev, "Probed. Set system clock to %u\n", i2c->sys_freq);
 
@@ -229,6 +229,8 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev,
 
 	return 0;
 
+error_free_irq:
+	pci_free_irq_vectors(pdev);
 error:
 	thunder_i2c_clock_disable(dev, i2c->clk);
 	return ret;
@@ -238,6 +240,7 @@ static void thunder_i2c_remove_pci(struct pci_dev *pdev)
 {
 	struct octeon_i2c *i2c = pci_get_drvdata(pdev);
 
+	pci_free_irq_vectors(pdev);
 	thunder_i2c_smbus_remove(i2c);
 	thunder_i2c_clock_disable(&pdev->dev, i2c->clk);
 	i2c_del_adapter(&i2c->adap);
-- 
2.25.0


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

* Re: [PATCH] i2c: thunderx: Fix an issue about missing call to 'pci_free_irq_vectors()'
  2021-02-14 14:37 [PATCH] i2c: thunderx: Fix an issue about missing call to 'pci_free_irq_vectors()' Dejin Zheng
@ 2021-02-18  9:29 ` Robert Richter
  2021-02-18  9:45 ` Robert Richter
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Richter @ 2021-02-18  9:29 UTC (permalink / raw)
  To: Dejin Zheng; +Cc: wsa+renesas, jan.glauber, linux-i2c, linux-kernel

On 14.02.21 22:37:34, Dejin Zheng wrote:
> Call to 'pci_free_irq_vectors()' are missing both in the error handling
> path of the probe function, and in the remove function. So add them.
> 
> Fixes: 4c21541d8da17fb ("i2c: thunderx: Replace pci_enable_msix()")
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>

This is already taken care of in pcim_release() as the device is
managed (pcim_enable_device()). Your change is not required.

-Robert

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

* Re: [PATCH] i2c: thunderx: Fix an issue about missing call to 'pci_free_irq_vectors()'
  2021-02-14 14:37 [PATCH] i2c: thunderx: Fix an issue about missing call to 'pci_free_irq_vectors()' Dejin Zheng
  2021-02-18  9:29 ` Robert Richter
@ 2021-02-18  9:45 ` Robert Richter
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Richter @ 2021-02-18  9:45 UTC (permalink / raw)
  To: Dejin Zheng; +Cc: wsa+renesas, jan.glauber, linux-i2c, linux-kernel

On 14.02.21 22:37:34, Dejin Zheng wrote:
> Call to 'pci_free_irq_vectors()' are missing both in the error handling
> path of the probe function, and in the remove function. So add them.
> 
> Fixes: 4c21541d8da17fb ("i2c: thunderx: Replace pci_enable_msix()")
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> ---
>  drivers/i2c/busses/i2c-thunderx-pcidrv.c | 9 ++++++---

FTR, I reviewed the error paths of thunder_i2c_probe_pci() (v5.11-rc1)
and all look sane to me.

-Robert

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

end of thread, other threads:[~2021-02-18 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 14:37 [PATCH] i2c: thunderx: Fix an issue about missing call to 'pci_free_irq_vectors()' Dejin Zheng
2021-02-18  9:29 ` Robert Richter
2021-02-18  9:45 ` Robert Richter

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