[HAL][TIM] Remove __HAL_LOCK() and __HAL_UNLOCK() invocation from both HAL_xxx_RegisterCallback() and HAL_xxx_UnRegisterCallback()
Rationale: HAL_xxx_RegisterCallback() must be called before HAL_xxx_Init(), which creates the semaphore used when invoking __HAL_LOCK() and __HAL_UNLOCK(). Invoking __HAL_LOCK() and __HAL_UNLOCK() in HAL_xxx_RegisterCallback() means using the semaphore before its creation.
diff --git a/Src/stm32l4xx_hal_tim.c b/Src/stm32l4xx_hal_tim.c
index 0e5712e..037f2d9 100644
--- a/Src/stm32l4xx_hal_tim.c
+++ b/Src/stm32l4xx_hal_tim.c
@@ -5987,8 +5987,6 @@
{
return HAL_ERROR;
}
- /* Process locked */
- __HAL_LOCK(htim);
if (htim->State == HAL_TIM_STATE_READY)
{
@@ -6184,9 +6182,6 @@
status = HAL_ERROR;
}
- /* Release Lock */
- __HAL_UNLOCK(htim);
-
return status;
}
@@ -6230,9 +6225,6 @@
{
HAL_StatusTypeDef status = HAL_OK;
- /* Process locked */
- __HAL_LOCK(htim);
-
if (htim->State == HAL_TIM_STATE_READY)
{
switch (CallbackID)
@@ -6469,9 +6461,6 @@
status = HAL_ERROR;
}
- /* Release Lock */
- __HAL_UNLOCK(htim);
-
return status;
}
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */