diff mbox series

dmaengine: ste_dma40: add missing free_irq() in error path

Message ID 20221115081546.2389164-1-ruanjinjie@huawei.com (mailing list archive)
State New, archived
Headers show
Series dmaengine: ste_dma40: add missing free_irq() in error path | expand

Commit Message

Jinjie Ruan Nov. 15, 2022, 8:15 a.m. UTC
free_irq() is missing in some cases of error in d40_probe(), fix that.

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

Comments

Linus Walleij Nov. 15, 2022, 10:12 p.m. UTC | #1
On Tue, Nov 15, 2022 at 9:19 AM ruanjinjie <ruanjinjie@huawei.com> wrote:

> free_irq() is missing in some cases of error in d40_probe(), fix that.
>
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>

Correct, but ... please just convert it to use
devm_request_irq() instead. Less lines of code.

Yours,
Linus Walleij
diff mbox series

Patch

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)