Aurora-QIU0 opened a new pull request, #20165:
URL: https://github.com/apache/nuttx/pull/20165

   ## Summary
   
   clock_t is unsigned unless CONFIG_SYSTEM_TIME64 is set (see sys/types.h). The
   comparison in esp_i2c_polling_waitdone():
   
       while (current - timeout < 0 && priv->error == 0)
   
   underflows to a large positive value, so the condition is always false and 
the
   loop body never runs. status keeps its initial value of zero and the function
   returns OK without ever waiting for the transfer.
   
   Under CONFIG_I2C_POLLED every transfer therefore reports completion 
immediately:
   no timeout is raised and register reads return whatever the RX FIFO happens 
to
   contain. This is a silent "false success" - no error is reported.
   
   Cast the difference to int32_t to restore the intended signed comparison. The
   result stays correct across counter wrap since the timeout is much shorter 
than
   the counter range.
   
   ## Impact
   
   - New feature? NO
   - Impact on user? NO (only corrects polling wait timeout)
   - Impact on build? NO
   - Impact on hardware? YES (risc-v/espressif I2C, polling mode)
   - Impact on documentation? NO
   - Impact on security? NO
   - Impact on compatibility? NO
   
   ## Testing
   
   Validated on real hardware during an ESP32-P4 board bring-up. Before the fix,
   I2C reads returned garbage (0x2f) with ret=0 - a mathematically impossible
   combination (status==0 yet success). After the fix, the GT911 touch 
controller
   enumerated correctly and register reads returned real values.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to