Bug in HAL_FLASHEx_Erase_IT - if process already ongoing then pFlash remains locked
HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
{
HAL_StatusTypeDef status = HAL_OK;
/* Process Locked */
__HAL_LOCK(&pFlash);
/* If procedure already ongoing, reject the next one */
if (pFlash.ProcedureOnGoing != FLASH_PROC_NONE)
{
>>> here must be __HAL_UNLOCK(&pFlash);
Hello @pi,
Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.
With regards, Rania
See also STM32CubeF4#88.
Hi @pi,
Could you please give us more details on how you encountered this issue so that we can better analyze it?
With regards,
Hi @TOUNSTM
I found this error while examining the function code. In fact, this error should never occur. Flash remains locked during any operations, so the condition (ProcedureOnGoing != FLASH_PROC_NONE) will never be satisfied. It's just that the eye caught on the potential for a deadlock to occur.
Hello @pi,
Indeed, the LOCK/UNLOCK mechanism is set to be removed from the HAL_FLASHEx_Erase_IT() and HAL_FLASH_Program_IT() APIs. Consequently, your change request is no longer applicable. Please allow me to close the issue.
Thank you for your understanding, and we appreciate your report.
ST Internal Reference: 185075