From c8415cd76b58d10aba27110c7a86bf40b2fe7a9a Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Wed, 11 Jun 2025 02:44:42 -0600 Subject: [PATCH] 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 --- drivers/i2c/i2c_npcx_controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c_npcx_controller.c b/drivers/i2c/i2c_npcx_controller.c index 2b4912e8591..6931fecb81d 100644 --- a/drivers/i2c/i2c_npcx_controller.c +++ b/drivers/i2c/i2c_npcx_controller.c @@ -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);