dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] dmaengine: altera-msgdma: correct mutex locking order
@ 2022-05-29 18:23 Nam Cao
  2022-05-31  3:00 ` Olivier dautricourt
  0 siblings, 1 reply; 2+ messages in thread
From: Nam Cao @ 2022-05-29 18:23 UTC (permalink / raw)
  To: vkoul, sr; +Cc: dmaengine, linux-kernel

The order of spin_unlock and spin_lock seems wrong. Correct it.

Signed-off-by: Nam Cao <namcaov@gmail.com>
---
Changes in v2:
	- Get rid of dirty index problem due to the patch being manually editted.

 drivers/dma/altera-msgdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
index 6f56dfd375e3..e35096c12abc 100644
--- a/drivers/dma/altera-msgdma.c
+++ b/drivers/dma/altera-msgdma.c
@@ -591,9 +591,9 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev)
 
 		dmaengine_desc_get_callback(&desc->async_tx, &cb);
 		if (dmaengine_desc_callback_valid(&cb)) {
-			spin_unlock(&mdev->lock);
-			dmaengine_desc_callback_invoke(&cb, NULL);
 			spin_lock(&mdev->lock);
+			dmaengine_desc_callback_invoke(&cb, NULL);
+			spin_unlock(&mdev->lock);
 		}
 
 		/* Run any dependencies, then free the descriptor */
-- 
2.25.1


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

* Re: [PATCH v2] dmaengine: altera-msgdma: correct mutex locking order
  2022-05-29 18:23 [PATCH v2] dmaengine: altera-msgdma: correct mutex locking order Nam Cao
@ 2022-05-31  3:00 ` Olivier dautricourt
  0 siblings, 0 replies; 2+ messages in thread
From: Olivier dautricourt @ 2022-05-31  3:00 UTC (permalink / raw)
  To: Nam Cao; +Cc: vkoul, sr, dmaengine, linux-kernel

On Sun, May 29, 2022 at 08:23:06PM +0200, Nam Cao wrote:
> The order of spin_unlock and spin_lock seems wrong. Correct it.
> 
> Signed-off-by: Nam Cao <namcaov@gmail.com>
> ---
> Changes in v2:
> 	- Get rid of dirty index problem due to the patch being manually editted.
> 
>  drivers/dma/altera-msgdma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
> index 6f56dfd375e3..e35096c12abc 100644
> --- a/drivers/dma/altera-msgdma.c
> +++ b/drivers/dma/altera-msgdma.c
> @@ -591,9 +591,9 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev)
>  
>  		dmaengine_desc_get_callback(&desc->async_tx, &cb);
>  		if (dmaengine_desc_callback_valid(&cb)) {
> -			spin_unlock(&mdev->lock);
> -			dmaengine_desc_callback_invoke(&cb, NULL);
>  			spin_lock(&mdev->lock);
> +			dmaengine_desc_callback_invoke(&cb, NULL);
> +			spin_unlock(&mdev->lock);
>  		}
>  
>  		/* Run any dependencies, then free the descriptor */
> -- 
> 2.25.1
> 
Hello,

the lock is first grabbed in msgdma_tasklet.

Kr,

Olivier

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

end of thread, other threads:[~2022-05-31  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 18:23 [PATCH v2] dmaengine: altera-msgdma: correct mutex locking order Nam Cao
2022-05-31  3:00 ` Olivier dautricourt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).