Open robcont opened 1 week ago
Hi @robcont! We appreciate you submitting your first issue for our open-source project. 🌟
Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙
Thank you for filing, I'll take a look.
Pull requests are also very welcome if you have a fix in mind
Describe the bug
The I2C DW target driver does not properly check the return values of callback functions as defined in the I2C target API. Specifically, the functions
i2c_target_write_requested_cb_t
,i2c_target_write_received_cb_t
,i2c_target_read_requested_cb_t
, andi2c_target_read_processed_cb_t
are being invoked without proper error handling of their return values, which may result in unexpected behavior.To Reproduce
The problem can be observed in the source code.
Expected behavior
The driver should check the return values of all callback functions and respond appropriately, such as NACKing or stopping the transfer when an error is returned.
Impact
This issue could lead to silent failures in I2C communication, making it difficult to debug I2C-related problems. It may cause data corruption or communication deadlocks in systems relying on proper I2C target behavior.
Logs and console output
N/A for this issue, as it's a code-level problem rather than a runtime error.
Environment (please complete the following information):
Additional context
Here's the problematic code: