mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: altera-msgdma: initialize state before requesting IRQ
@ 2026-08-30  5:33 Runyu Xiao
  2026-08-31 15:50 ` Frank Li
  2026-09-01  7:21 ` Ng, Adrian Ho Yin
  0 siblings, 2 replies; 3+ messages in thread
From: Runyu Xiao @ 2026-08-30  5:33 UTC (permalink / raw)
  To: adrian.ho.yin.ng
  Cc: sr, vkoul, Frank.Li, dmaengine, linux-kernel, stable, runyu.xiao,
	jianhao.xu

msgdma_probe() registers the IRQ before initializing the tasklet, lock,
and descriptor lists used by the interrupt handler. A pending interrupt
can access incomplete state during probe.

Initialize the handler state before requesting the IRQ so the interrupt
path observes ready software state.

Fixes: a85c6f1b2921 ("dmaengine: Add driver for Altera / Intel mSGDMA IP core")
Cc: stable@vger.kernel.org
Assisted-by: Codex:GPT-5
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/dma/altera-msgdma.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
index e23e5b441..412f4bce1 100644
--- a/drivers/dma/altera-msgdma.c
+++ b/drivers/dma/altera-msgdma.c
@@ -847,11 +847,6 @@ static int msgdma_probe(struct platform_device *pdev)
 	if (mdev->irq < 0)
 		return -ENXIO;
 
-	ret = devm_request_irq(&pdev->dev, mdev->irq, msgdma_irq_handler,
-			       0, dev_name(&pdev->dev), mdev);
-	if (ret)
-		return ret;
-
 	tasklet_setup(&mdev->irq_tasklet, msgdma_tasklet);
 
 	dma_cookie_init(&mdev->dmachan);
@@ -863,6 +858,11 @@ static int msgdma_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&mdev->done_list);
 	INIT_LIST_HEAD(&mdev->free_list);
 
+	ret = devm_request_irq(&pdev->dev, mdev->irq, msgdma_irq_handler,
+			       0, dev_name(&pdev->dev), mdev);
+	if (ret)
+		return ret;
+
 	dma_dev = &mdev->dmadev;
 
 	/* Set DMA capabilities */
-- 
2.34.1

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

* Re: [PATCH] dmaengine: altera-msgdma: initialize state before requesting IRQ
  2026-08-30  5:33 [PATCH] dmaengine: altera-msgdma: initialize state before requesting IRQ Runyu Xiao
@ 2026-08-31 15:50 ` Frank Li
  2026-09-01  7:21 ` Ng, Adrian Ho Yin
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-08-31 15:50 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: adrian.ho.yin.ng, sr, vkoul, Frank.Li, dmaengine, linux-kernel,
	stable, jianhao.xu

On Sun, Aug 30, 2026 at 01:33:08PM +0800, Runyu Xiao wrote:
> msgdma_probe() registers the IRQ before initializing the tasklet, lock,
> and descriptor lists used by the interrupt handler. A pending interrupt
> can access incomplete state during probe.
>
> Initialize the handler state before requesting the IRQ so the interrupt
> path observes ready software state.
>
> Fixes: a85c6f1b2921 ("dmaengine: Add driver for Altera / Intel mSGDMA IP core")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---

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

>  drivers/dma/altera-msgdma.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
> index e23e5b441..412f4bce1 100644
> --- a/drivers/dma/altera-msgdma.c
> +++ b/drivers/dma/altera-msgdma.c
> @@ -847,11 +847,6 @@ static int msgdma_probe(struct platform_device *pdev)
>  	if (mdev->irq < 0)
>  		return -ENXIO;
>
> -	ret = devm_request_irq(&pdev->dev, mdev->irq, msgdma_irq_handler,
> -			       0, dev_name(&pdev->dev), mdev);
> -	if (ret)
> -		return ret;
> -
>  	tasklet_setup(&mdev->irq_tasklet, msgdma_tasklet);
>
>  	dma_cookie_init(&mdev->dmachan);
> @@ -863,6 +858,11 @@ static int msgdma_probe(struct platform_device *pdev)
>  	INIT_LIST_HEAD(&mdev->done_list);
>  	INIT_LIST_HEAD(&mdev->free_list);
>
> +	ret = devm_request_irq(&pdev->dev, mdev->irq, msgdma_irq_handler,
> +			       0, dev_name(&pdev->dev), mdev);
> +	if (ret)
> +		return ret;
> +
>  	dma_dev = &mdev->dmadev;
>
>  	/* Set DMA capabilities */
> --
> 2.34.1

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

* Re: [PATCH] dmaengine: altera-msgdma: initialize state before requesting IRQ
  2026-08-30  5:33 [PATCH] dmaengine: altera-msgdma: initialize state before requesting IRQ Runyu Xiao
  2026-08-31 15:50 ` Frank Li
@ 2026-09-01  7:21 ` Ng, Adrian Ho Yin
  1 sibling, 0 replies; 3+ messages in thread
From: Ng, Adrian Ho Yin @ 2026-09-01  7:21 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: sr, vkoul, Frank.Li, dmaengine, linux-kernel, stable, jianhao.xu

On 8/30/2026 1:33 PM, Runyu Xiao wrote:
> msgdma_probe() registers the IRQ before initializing the tasklet, lock,
> and descriptor lists used by the interrupt handler. A pending interrupt
> can access incomplete state during probe.
> 
> Initialize the handler state before requesting the IRQ so the interrupt
> path observes ready software state.
> 
> Fixes: a85c6f1b2921 ("dmaengine: Add driver for Altera / Intel mSGDMA IP core")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---

Acked-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>

>   drivers/dma/altera-msgdma.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
> index e23e5b441..412f4bce1 100644
> --- a/drivers/dma/altera-msgdma.c
> +++ b/drivers/dma/altera-msgdma.c
> @@ -847,11 +847,6 @@ static int msgdma_probe(struct platform_device *pdev)
>   	if (mdev->irq < 0)
>   		return -ENXIO;
>   
> -	ret = devm_request_irq(&pdev->dev, mdev->irq, msgdma_irq_handler,
> -			       0, dev_name(&pdev->dev), mdev);
> -	if (ret)
> -		return ret;
> -
>   	tasklet_setup(&mdev->irq_tasklet, msgdma_tasklet);
>   
>   	dma_cookie_init(&mdev->dmachan);
> @@ -863,6 +858,11 @@ static int msgdma_probe(struct platform_device *pdev)
>   	INIT_LIST_HEAD(&mdev->done_list);
>   	INIT_LIST_HEAD(&mdev->free_list);
>   
> +	ret = devm_request_irq(&pdev->dev, mdev->irq, msgdma_irq_handler,
> +			       0, dev_name(&pdev->dev), mdev);
> +	if (ret)
> +		return ret;
> +
>   	dma_dev = &mdev->dmadev;
>   
>   	/* Set DMA capabilities */


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

end of thread, other threads:[~2026-09-01  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-30  5:33 [PATCH] dmaengine: altera-msgdma: initialize state before requesting IRQ Runyu Xiao
2026-08-31 15:50 ` Frank Li
2026-09-01  7:21 ` Ng, Adrian Ho Yin

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®