This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit cc632ea789ea2675f396c4f74492afcde4ce5067 Author: David Sidrane <david.sidr...@nscdg.com> AuthorDate: Wed Nov 22 09:17:05 2023 -0800 imxrt:edma clear state before callback --- arch/arm/src/imxrt/imxrt_edma.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/imxrt/imxrt_edma.c b/arch/arm/src/imxrt/imxrt_edma.c index ad16fe023b..6ce69fbb92 100644 --- a/arch/arm/src/imxrt/imxrt_edma.c +++ b/arch/arm/src/imxrt/imxrt_edma.c @@ -438,6 +438,8 @@ static void imxrt_dmaterminate(struct imxrt_dmach_s *dmach, int result) uintptr_t regaddr; uint8_t regval8; uint8_t chan; + edma_callback_t callback; + void *arg; /* Disable channel ERROR interrupts */ @@ -479,14 +481,17 @@ static void imxrt_dmaterminate(struct imxrt_dmach_s *dmach, int result) /* Perform the DMA complete callback */ - if (dmach->callback) - { - dmach->callback((DMACH_HANDLE)dmach, dmach->arg, true, result); - } + callback = dmach->callback; + arg = dmach->arg; dmach->callback = NULL; dmach->arg = NULL; dmach->state = IMXRT_DMA_IDLE; + + if (callback) + { + callback((DMACH_HANDLE)dmach, arg, true, result); + } } /****************************************************************************