[PATCH] dmaengine: ste_dma40: add missing free_irq() in error path

ruanjinjie ruanjinjie at huawei.com
Tue Nov 15 00:15:46 PST 2022


free_irq() is missing in some cases of error in d40_probe(), fix that.

Signed-off-by: ruanjinjie <ruanjinjie at huawei.com>
---
 drivers/dma/ste_dma40.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index f093e08c23b1..1cedb53bc3dd 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3611,7 +3611,7 @@ static int __init d40_probe(struct platform_device *pdev)
 			d40_err(&pdev->dev, "Failed to get lcpa_regulator\n");
 			ret = PTR_ERR(base->lcpa_regulator);
 			base->lcpa_regulator = NULL;
-			goto destroy_cache;
+			goto free_irq;
 		}
 
 		ret = regulator_enable(base->lcpa_regulator);
@@ -3620,7 +3620,7 @@ static int __init d40_probe(struct platform_device *pdev)
 				"Failed to enable lcpa_regulator\n");
 			regulator_put(base->lcpa_regulator);
 			base->lcpa_regulator = NULL;
-			goto destroy_cache;
+			goto free_irq;
 		}
 	}
 
@@ -3635,12 +3635,12 @@ static int __init d40_probe(struct platform_device *pdev)
 
 	ret = d40_dmaengine_init(base, num_reserved_chans);
 	if (ret)
-		goto destroy_cache;
+		goto free_irq;
 
 	ret = dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE);
 	if (ret) {
 		d40_err(&pdev->dev, "Failed to set dma max seg size\n");
-		goto destroy_cache;
+		goto free_irq;
 	}
 
 	d40_hw_init(base);
@@ -3654,6 +3654,8 @@ static int __init d40_probe(struct platform_device *pdev)
 
 	dev_info(base->dev, "initialized\n");
 	return 0;
+free_irq:
+	free_irq(base->irq, base);
  destroy_cache:
 	kmem_cache_destroy(base->desc_slab);
 	if (base->virtbase)
-- 
2.25.1




More information about the linux-arm-kernel mailing list