[HAL][LPTIM] 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_lptim.c b/Src/stm32l4xx_hal_lptim.c
index 3e64eff..b461fc8 100644
--- a/Src/stm32l4xx_hal_lptim.c
+++ b/Src/stm32l4xx_hal_lptim.c
@@ -2246,9 +2246,6 @@
return HAL_ERROR;
}
- /* Process locked */
- __HAL_LOCK(hlptim);
-
if (hlptim->State == HAL_LPTIM_STATE_READY)
{
switch (CallbackID)
@@ -2329,9 +2326,6 @@
status = HAL_ERROR;
}
- /* Release Lock */
- __HAL_UNLOCK(hlptim);
-
return status;
}
@@ -2359,9 +2353,6 @@
{
HAL_StatusTypeDef status = HAL_OK;
- /* Process locked */
- __HAL_LOCK(hlptim);
-
if (hlptim->State == HAL_LPTIM_STATE_READY)
{
switch (CallbackID)
@@ -2455,9 +2446,6 @@
status = HAL_ERROR;
}
- /* Release Lock */
- __HAL_UNLOCK(hlptim);
-
return status;
}
#endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */