Skip to content

Commit c94a993

Browse files
anchaoxiaoxiang781216
authored andcommitted
arch/arm: read STM32L4_GTIM_CNT_OFFSET should use same lock
Signed-off-by: chao an <[email protected]>
1 parent c6126bc commit c94a993

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm/src/stm32l4/stm32l4_qencoder.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1086,10 +1086,10 @@ static int stm32l4_reset(struct qe_lowerhalf_s *lower)
10861086
* Interrupts are disabled to make this atomic (if possible)
10871087
*/
10881088

1089-
flags = enter_critical_section();
1089+
flags = spin_lock_irqsave(&priv->lock);
10901090
stm32l4_putreg32(priv, STM32L4_GTIM_CNT_OFFSET, 0);
10911091
priv->position = 0;
1092-
leave_critical_section(flags);
1092+
spin_unlock_irqrestore(&priv->lock, flags);
10931093
#else
10941094
sninfo("Resetting position to zero\n");
10951095
DEBUGASSERT(lower && priv->inuse);

0 commit comments

Comments
 (0)