DMA Engine development
 help / color / mirror / Atom feed
* [PATCH] dma: at_hdmac: Fix IRQ leak in at_dma_probe()
@ 2026-05-07  7:57 Hongling Zeng
  2026-05-07 18:24 ` Frank Li
  0 siblings, 1 reply; 4+ messages in thread
From: Hongling Zeng @ 2026-05-07  7:57 UTC (permalink / raw)
  To: ludovic.desroches, vkoul, Frank.Li, djbw, nicolas.ferre,
	maciej.sosnowski
  Cc: dmaengine, linux-kernel, zhongling0719, Hongling Zeng

When request_irq() succeeds but a later error occurs in at_dma_probe(),
the error handling path attempts to free the IRQ by calling
platform_get_irq() again instead of using the already stored IRQ number
in the local variable 'irq'.

Fix this by using the stored 'irq' variable directly in free_irq().

Fixes: dc78baa2b90b2 ("dmaengine: Atmel HDMAC driver")
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
---
 drivers/dma/at_hdmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e5b30a57c477..2a860679b9e1 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -2109,7 +2109,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 err_memset_pool_create:
 	dma_pool_destroy(atdma->lli_pool);
 err_desc_pool_create:
-	free_irq(platform_get_irq(pdev, 0), atdma);
+	free_irq(irq, atdma);
 err_irq:
 	clk_disable_unprepare(atdma->clk);
 	return err;
-- 
2.25.1


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

* Re: [PATCH] dma: at_hdmac: Fix IRQ leak in at_dma_probe()
  2026-05-07  7:57 [PATCH] dma: at_hdmac: Fix IRQ leak in at_dma_probe() Hongling Zeng
@ 2026-05-07 18:24 ` Frank Li
  2026-05-08  1:33   ` dd
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Li @ 2026-05-07 18:24 UTC (permalink / raw)
  To: Hongling Zeng
  Cc: ludovic.desroches, vkoul, Frank.Li, djbw, nicolas.ferre,
	maciej.sosnowski, dmaengine, linux-kernel, zhongling0719

On Thu, May 07, 2026 at 03:57:50PM +0800, Hongling Zeng wrote:
> When request_irq() succeeds but a later error occurs in at_dma_probe(),
> the error handling path attempts to free the IRQ by calling
> platform_get_irq() again instead of using the already stored IRQ number
> in the local variable 'irq'.
>
> Fix this by using the stored 'irq' variable directly in free_irq().
>
> Fixes: dc78baa2b90b2 ("dmaengine: Atmel HDMAC driver")

Any actual problem do you meet? suppose it should be the same as 'irq'.

of course using varible irq is correct. but this patch should belong code
cleanup, not fix.

Frank

> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
>  drivers/dma/at_hdmac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e5b30a57c477..2a860679b9e1 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -2109,7 +2109,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  err_memset_pool_create:
>  	dma_pool_destroy(atdma->lli_pool);
>  err_desc_pool_create:
> -	free_irq(platform_get_irq(pdev, 0), atdma);
> +	free_irq(irq, atdma);
>  err_irq:
>  	clk_disable_unprepare(atdma->clk);
>  	return err;
> --
> 2.25.1
>

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

* Re:Re: [PATCH] dma: at_hdmac: Fix IRQ leak in at_dma_probe()
  2026-05-07 18:24 ` Frank Li
@ 2026-05-08  1:33   ` dd
  2026-05-08 19:46     ` Frank Li
  0 siblings, 1 reply; 4+ messages in thread
From: dd @ 2026-05-08  1:33 UTC (permalink / raw)
  To: Frank Li
  Cc: Hongling Zeng, ludovic.desroches, vkoul, Frank.Li, djbw,
	nicolas.ferre, maciej.sosnowski, dmaengine, linux-kernel




Hi Frank,

Thanks for your review.

You're right that in the normal case platform_get_irq() returns the

same value as 'irq'. However, this pattern triggers a smatch warning:

           drivers/dma/at_hdmac.c:2110 at_dma_probe()

           warn: 'irq' from request_irq() not released on lines: 2110.

Static analysis tools cannot guarantee that platform_get_irq() will

always match the previously requested IRQ, so they treat it as a

potential resource leak.

Using the stored 'irq' makes the error path unambiguous and silences

the warning. Therefore I think it qualifies as a small bug fix rather

than just cleanup.

Thanks,



At 2026-05-08 02:24:52, "Frank Li" <Frank.li@nxp.com> wrote:
>On Thu, May 07, 2026 at 03:57:50PM +0800, Hongling Zeng wrote:
>> When request_irq() succeeds but a later error occurs in at_dma_probe(),
>> the error handling path attempts to free the IRQ by calling
>> platform_get_irq() again instead of using the already stored IRQ number
>> in the local variable 'irq'.
>>
>> Fix this by using the stored 'irq' variable directly in free_irq().
>>
>> Fixes: dc78baa2b90b2 ("dmaengine: Atmel HDMAC driver")
>
>Any actual problem do you meet? suppose it should be the same as 'irq'.
>
>of course using varible irq is correct. but this patch should belong code
>cleanup, not fix.
>
>Frank
>
>> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
>> ---
>>  drivers/dma/at_hdmac.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index e5b30a57c477..2a860679b9e1 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -2109,7 +2109,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>>  err_memset_pool_create:
>>  	dma_pool_destroy(atdma->lli_pool);
>>  err_desc_pool_create:
>> -	free_irq(platform_get_irq(pdev, 0), atdma);
>> +	free_irq(irq, atdma);
>>  err_irq:
>>  	clk_disable_unprepare(atdma->clk);
>>  	return err;
>> --
>> 2.25.1
>>

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

* Re: Re: [PATCH] dma: at_hdmac: Fix IRQ leak in at_dma_probe()
  2026-05-08  1:33   ` dd
@ 2026-05-08 19:46     ` Frank Li
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-05-08 19:46 UTC (permalink / raw)
  To: dd
  Cc: Hongling Zeng, ludovic.desroches, vkoul, Frank.Li, djbw,
	nicolas.ferre, maciej.sosnowski, dmaengine, linux-kernel

On Fri, May 08, 2026 at 09:33:19AM +0800, dd wrote:
>
>
>
> Hi Frank,
>
> Thanks for your review.

Avoid top post

>
> You're right that in the normal case platform_get_irq() returns the
>
> same value as 'irq'. However, this pattern triggers a smatch warning:
>
>            drivers/dma/at_hdmac.c:2110 at_dma_probe()
>
>            warn: 'irq' from request_irq() not released on lines: 2110.
>
> Static analysis tools cannot guarantee that platform_get_irq() will
>
> always match the previously requested IRQ, so they treat it as a
>
> potential resource leak.

It is false alarm from static analysis tools.

>
> Using the stored 'irq' makes the error path unambiguous and silences
>
> the warning. Therefore I think it qualifies as a small bug fix rather
>
> than just cleanup.

So it still belong code cleanup, no user visible impact.


Frank

>
> Thanks,
>
>
>
> At 2026-05-08 02:24:52, "Frank Li" <Frank.li@nxp.com> wrote:
> >On Thu, May 07, 2026 at 03:57:50PM +0800, Hongling Zeng wrote:
> >> When request_irq() succeeds but a later error occurs in at_dma_probe(),
> >> the error handling path attempts to free the IRQ by calling
> >> platform_get_irq() again instead of using the already stored IRQ number
> >> in the local variable 'irq'.
> >>
> >> Fix this by using the stored 'irq' variable directly in free_irq().
> >>
> >> Fixes: dc78baa2b90b2 ("dmaengine: Atmel HDMAC driver")
> >
> >Any actual problem do you meet? suppose it should be the same as 'irq'.
> >
> >of course using varible irq is correct. but this patch should belong code
> >cleanup, not fix.
> >
> >Frank
> >
> >> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> >> ---
> >>  drivers/dma/at_hdmac.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> >> index e5b30a57c477..2a860679b9e1 100644
> >> --- a/drivers/dma/at_hdmac.c
> >> +++ b/drivers/dma/at_hdmac.c
> >> @@ -2109,7 +2109,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
> >>  err_memset_pool_create:
> >>  	dma_pool_destroy(atdma->lli_pool);
> >>  err_desc_pool_create:
> >> -	free_irq(platform_get_irq(pdev, 0), atdma);
> >> +	free_irq(irq, atdma);
> >>  err_irq:
> >>  	clk_disable_unprepare(atdma->clk);
> >>  	return err;
> >> --
> >> 2.25.1
> >>

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

end of thread, other threads:[~2026-05-08 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07  7:57 [PATCH] dma: at_hdmac: Fix IRQ leak in at_dma_probe() Hongling Zeng
2026-05-07 18:24 ` Frank Li
2026-05-08  1:33   ` dd
2026-05-08 19:46     ` Frank Li

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