From 91034ff4d69e7891055c58540f9f82463f68432e Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Mon, 23 Oct 2023 04:21:32 -0700 Subject: [PATCH] s32k3xx:lpi2c Timeouts can not be 0 --- arch/arm/src/s32k3xx/s32k3xx_lpi2c.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/s32k3xx/s32k3xx_lpi2c.c b/arch/arm/src/s32k3xx/s32k3xx_lpi2c.c index 7dedd48a1a..9ec3269ba7 100644 --- a/arch/arm/src/s32k3xx/s32k3xx_lpi2c.c +++ b/arch/arm/src/s32k3xx/s32k3xx_lpi2c.c @@ -463,8 +463,9 @@ static inline void #ifdef CONFIG_S32K3XX_I2C_DYNTIMEO static uint32_t s32k3xx_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs) { - size_t bytecount = 0; int i; + size_t bytecount = 0; + uint32_t tick = 0; /* Count the number of bytes left to process */ @@ -477,7 +478,13 @@ static uint32_t s32k3xx_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs) * factor. */ - return USEC2TICK(CONFIG_S32K3XX_I2C_DYNTIMEO_USECPERBYTE * bytecount); + tick = USEC2TICK(CONFIG_S32K3XX_I2C_DYNTIMEO_USECPERBYTE * bytecount); + if (tick == 0) + { + tick = 1; + } + + return tick; } #endif