diff mbox

[1/2] dmaengine: at_xdmac: Remove unnecessary synchronize_irq() before free_irq()

Message ID 1448104188-19836-1-git-send-email-lars@metafoo.de (mailing list archive)
State Accepted
Headers show

Commit Message

Lars-Peter Clausen Nov. 21, 2015, 11:09 a.m. UTC
Calling synchronize_irq() right before free_irq() is quite useless. On one
hand the IRQ can easily fire again before free_irq() is entered, on the
other hand free_irq() itself calls synchronize_irq() internally (in a race
condition free way), before any state associated with the IRQ is freed.

Patch was generated using the following semantic patch:
// <smpl>
@@
expression irq;
@@
-synchronize_irq(irq);
 free_irq(irq, ...);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/dma/at_xdmac.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Ludovic Desroches Nov. 25, 2015, 3:35 p.m. UTC | #1
On Sat, Nov 21, 2015 at 12:09:47PM +0100, Lars-Peter Clausen wrote:
> Calling synchronize_irq() right before free_irq() is quite useless. On one
> hand the IRQ can easily fire again before free_irq() is entered, on the
> other hand free_irq() itself calls synchronize_irq() internally (in a race
> condition free way), before any state associated with the IRQ is freed.
> 
> Patch was generated using the following semantic patch:
> // <smpl>
> @@
> expression irq;
> @@
> -synchronize_irq(irq);
>  free_irq(irq, ...);
> // </smpl>
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

It sounds good.
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>

> ---
>  drivers/dma/at_xdmac.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index 7f039de..d02276f 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1995,8 +1995,6 @@ static int at_xdmac_remove(struct platform_device *pdev)
>  	dma_async_device_unregister(&atxdmac->dma);
>  	clk_disable_unprepare(atxdmac->clk);
>  
> -	synchronize_irq(atxdmac->irq);
> -
>  	free_irq(atxdmac->irq, atxdmac->dma.dev);
>  
>  	for (i = 0; i < atxdmac->dma.chancnt; i++) {
> -- 
> 2.1.4
> 
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul Dec. 5, 2015, 10:27 a.m. UTC | #2
On Sat, Nov 21, 2015 at 12:09:47PM +0100, Lars-Peter Clausen wrote:
> Calling synchronize_irq() right before free_irq() is quite useless. On one
> hand the IRQ can easily fire again before free_irq() is entered, on the
> other hand free_irq() itself calls synchronize_irq() internally (in a race
> condition free way), before any state associated with the IRQ is freed.
> 
> Patch was generated using the following semantic patch:
> // <smpl>
> @@
> expression irq;
> @@
> -synchronize_irq(irq);
>  free_irq(irq, ...);
> // </smpl>

Applied, both

Thanks
diff mbox

Patch

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index 7f039de..d02276f 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1995,8 +1995,6 @@  static int at_xdmac_remove(struct platform_device *pdev)
 	dma_async_device_unregister(&atxdmac->dma);
 	clk_disable_unprepare(atxdmac->clk);
 
-	synchronize_irq(atxdmac->irq);
-
 	free_irq(atxdmac->irq, atxdmac->dma.dev);
 
 	for (i = 0; i < atxdmac->dma.chancnt; i++) {