i2c: npcx: Verify msg is not null

When using target mode, we've found that some times the msg field can
be null through some of the code paths of the interrupt event handler.

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2025-06-11 02:44:42 -06:00 committed by Benjamin Cabé
commit c8415cd76b

View file

@ -753,7 +753,7 @@ static void i2c_ctrl_handle_read_int_event(const struct device *dev)
}
/* Is the STOP condition issued? */
if ((data->msg->flags & I2C_MSG_STOP) != 0) {
if (data->msg != NULL && (data->msg->flags & I2C_MSG_STOP) != 0) {
/* Clear rx FIFO threshold and status bits */
i2c_ctrl_fifo_clear_status(dev);