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

From: Christophe JAILLET
Date: Sat Jan 18 2025 - 10:51:44 EST


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@xxxxxxxxxx>
---
Compile tested only
---
drivers/dma/amd/ptdma/ptdma-pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

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

--
2.48.1