mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [PATCH v2] dmaengine: amlogic: Fix missing destroy_workqueue() at error path in aml_dma_probe()
@ 2026-10-24  9:05 Christophe JAILLET
  2026-10-26 16:53 ` Frank Li
  2026-10-27  3:22 ` Xianwei Zhao
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2026-10-24  9:05 UTC (permalink / raw)
  To: Xianwei Zhao, Vinod Koul, Frank Li
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-amlogic,
	dmaengine

If an error occurs after the alloc_ordered_workqueue() call, the
corresponding memory is never released.

Use the managed version instead, as already done by most functions in the
probe and simplify the remove function accordingly.

This avoids the leak.

Fixes: b84b5197e344 ("dmaengine: amlogic: Add general DMA driver for A9")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.

Changes in v2:
  - update the subject   [Franck Li]

v1: https://lore.kernel.org/lkml/93183551770e260aff993bb4cf1ce5ba8dc1e732.1792785154.git.christophe.jaillet@wanadoo.fr/
---
 drivers/dma/amlogic-dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/amlogic-dma.c b/drivers/dma/amlogic-dma.c
index 684121d13fca..791bd82743d3 100644
--- a/drivers/dma/amlogic-dma.c
+++ b/drivers/dma/amlogic-dma.c
@@ -620,7 +620,7 @@ static int aml_dma_probe(struct platform_device *pdev)
 	if (!aml_dma)
 		return -ENOMEM;
 
-	aml_dma->free_wq = alloc_ordered_workqueue("aml_dma_free", 0);
+	aml_dma->free_wq = devm_alloc_ordered_workqueue(&pdev->dev, "aml_dma_free", 0);
 	if (!aml_dma->free_wq)
 		return -ENOMEM;
 
@@ -712,7 +712,6 @@ static void aml_dma_remove(struct platform_device *pdev)
 		if (aml_chan)
 			tasklet_kill(&aml_chan->vchan.task);
 	}
-	destroy_workqueue(aml_dma->free_wq);
 }
 
 static const struct of_device_id aml_dma_ids[] = {
-- 
2.56.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v2] dmaengine: amlogic: Fix missing destroy_workqueue() at error path in aml_dma_probe()
  2026-10-24  9:05 [PATCH v2] dmaengine: amlogic: Fix missing destroy_workqueue() at error path in aml_dma_probe() Christophe JAILLET
@ 2026-10-26 16:53 ` Frank Li
  2026-10-27  3:22 ` Xianwei Zhao
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-10-26 16:53 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Xianwei Zhao, Vinod Koul, Frank Li, linux-kernel,
	kernel-janitors, linux-amlogic, dmaengine

On Sat, Oct 24, 2026 at 11:05:13AM +0200, Christophe JAILLET wrote:
> If an error occurs after the alloc_ordered_workqueue() call, the
> corresponding memory is never released.
>
> Use the managed version instead, as already done by most functions in the
> probe and simplify the remove function accordingly.
>
> This avoids the leak.
>
> Fixes: b84b5197e344 ("dmaengine: amlogic: Add general DMA driver for A9")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> Compile tested only.
>
> Changes in v2:
>   - update the subject   [Franck Li]
>
> v1: https://lore.kernel.org/lkml/93183551770e260aff993bb4cf1ce5ba8dc1e732.1792785154.git.christophe.jaillet@wanadoo.fr/
> ---
>  drivers/dma/amlogic-dma.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/amlogic-dma.c b/drivers/dma/amlogic-dma.c
> index 684121d13fca..791bd82743d3 100644
> --- a/drivers/dma/amlogic-dma.c
> +++ b/drivers/dma/amlogic-dma.c
> @@ -620,7 +620,7 @@ static int aml_dma_probe(struct platform_device *pdev)
>  	if (!aml_dma)
>  		return -ENOMEM;
>
> -	aml_dma->free_wq = alloc_ordered_workqueue("aml_dma_free", 0);
> +	aml_dma->free_wq = devm_alloc_ordered_workqueue(&pdev->dev, "aml_dma_free", 0);
>  	if (!aml_dma->free_wq)
>  		return -ENOMEM;
>
> @@ -712,7 +712,6 @@ static void aml_dma_remove(struct platform_device *pdev)
>  		if (aml_chan)
>  			tasklet_kill(&aml_chan->vchan.task);
>  	}
> -	destroy_workqueue(aml_dma->free_wq);
>  }
>
>  static const struct of_device_id aml_dma_ids[] = {
> --
> 2.56.0
>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v2] dmaengine: amlogic: Fix missing destroy_workqueue() at error path in aml_dma_probe()
  2026-10-24  9:05 [PATCH v2] dmaengine: amlogic: Fix missing destroy_workqueue() at error path in aml_dma_probe() Christophe JAILLET
  2026-10-26 16:53 ` Frank Li
@ 2026-10-27  3:22 ` Xianwei Zhao
  1 sibling, 0 replies; 3+ messages in thread
From: Xianwei Zhao @ 2026-10-27  3:22 UTC (permalink / raw)
  To: Christophe JAILLET, Vinod Koul, Frank Li
  Cc: linux-kernel, kernel-janitors, linux-amlogic, dmaengine


Reviewed-by: Xianwei Zhao <xianwei.zhao@amlogic.com>

On 2026/10/24 17:05, Christophe JAILLET wrote:
> If an error occurs after the alloc_ordered_workqueue() call, the
> corresponding memory is never released.
> 
> Use the managed version instead, as already done by most functions in the
> probe and simplify the remove function accordingly.
> 
> This avoids the leak.
> 
> Fixes: b84b5197e344 ("dmaengine: amlogic: Add general DMA driver for A9")
> Signed-off-by: Christophe JAILLET<christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
> 
> Changes in v2:
>    - update the subject   [Franck Li]
> 
> v1:https://lore.kernel.org/lkml/93183551770e260aff993bb4cf1ce5ba8dc1e732.1792785154.git.christophe.jaillet@wanadoo.fr/
> ---
>   drivers/dma/amlogic-dma.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/amlogic-dma.c b/drivers/dma/amlogic-dma.c
> index 684121d13fca..791bd82743d3 100644
> --- a/drivers/dma/amlogic-dma.c
> +++ b/drivers/dma/amlogic-dma.c
> @@ -620,7 +620,7 @@ static int aml_dma_probe(struct platform_device *pdev)
>          if (!aml_dma)
>                  return -ENOMEM;
> 
> -       aml_dma->free_wq = alloc_ordered_workqueue("aml_dma_free", 0);
> +       aml_dma->free_wq = devm_alloc_ordered_workqueue(&pdev->dev, "aml_dma_free", 0);
>          if (!aml_dma->free_wq)
>                  return -ENOMEM;
> 
> @@ -712,7 +712,6 @@ static void aml_dma_remove(struct platform_device *pdev)
>                  if (aml_chan)
>                          tasklet_kill(&aml_chan->vchan.task);
>          }
> -       destroy_workqueue(aml_dma->free_wq);
>   }
> 
>   static const struct of_device_id aml_dma_ids[] = {

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2026-10-27  3:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-24  9:05 [PATCH v2] dmaengine: amlogic: Fix missing destroy_workqueue() at error path in aml_dma_probe() Christophe JAILLET
2026-10-26 16:53 ` Frank Li
2026-10-27  3:22 ` Xianwei Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®