arch/arm/src/stm32f7/stm32_i2c.c: Fix another memory access issue on a bus error.

This commit is contained in:
David Sidrane
2019-02-19 14:47:05 -06:00
committed by Gregory Nutt
parent 88130512b8
commit 44919b6723
+11 -4
View File
@@ -1751,7 +1751,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
* can't write NBYTES to clear TCR so it will fire forever. * can't write NBYTES to clear TCR so it will fire forever.
*/ */
if ((priv->msgc - 1) == 0) if (priv->msgc == 1)
{ {
stm32_i2c_disable_reload(priv); stm32_i2c_disable_reload(priv);
} }
@@ -1902,11 +1902,18 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
i2cinfo("TC: ENTER dcnt = %i msgc = %i status 0x%08x\n", i2cinfo("TC: ENTER dcnt = %i msgc = %i status 0x%08x\n",
priv->dcnt, priv->msgc, status); priv->dcnt, priv->msgc, status);
/* Prior message has been sent successfully */ /* Prior message has been sent successfully. Or there could have
* been an error that set msgc to 0; So test for that case as
* we do not want to decrement msgc less then zero nor move msgv
* past the last message.
*/
priv->msgc--; if (priv->msgc > 0)
{
priv->msgc--;
}
/* if additional messages remain to be transmitted / received */ /* Are there additional messages remain to be transmitted / received? */
if (priv->msgc > 0) if (priv->msgc > 0)
{ {