diff mbox series

[1/3] dmaengine: ptdma: Fix an error handling parth in pt_pci_probe()

Message ID ae19d76a10773d6ebee0e08cef49786eb20fd052.1737215423.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New
Headers show
Series [1/3] dmaengine: ptdma: Fix an error handling parth in pt_pci_probe() | expand

Commit Message

Christophe JAILLET Jan. 18, 2025, 3:51 p.m. UTC
If an error occurs after a successful pt_get_irqs() call, it should be
undone by a corresponding pt_free_irqs(), as already done in the remove
function.

Fixes: fa5d823b16a9 ("dmaengine: ptdma: Initial driver for the AMD PTDMA")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/dma/amd/ptdma/ptdma-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/dma/amd/ptdma/ptdma-pci.c b/drivers/dma/amd/ptdma/ptdma-pci.c
index 22739ff0c3c5..7f12474bd39f 100644
--- a/drivers/dma/amd/ptdma/ptdma-pci.c
+++ b/drivers/dma/amd/ptdma/ptdma-pci.c
@@ -182,7 +182,7 @@  static int pt_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		if (ret) {
 			dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n",
 				ret);
-			goto e_err;
+			goto e_free_irqs;
 		}
 	}
 
@@ -192,10 +192,12 @@  static int pt_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		ret = pt_core_init(pt);
 
 	if (ret)
-		goto e_err;
+		goto e_free_irqs;
 
 	return 0;
 
+e_free_irqs:
+	pt_free_irqs(pt);
 e_err:
 	dev_err(dev, "initialization failed ret = %d\n", ret);