From 83192c71e413acd795fd9082b3b8ac59d199cbf6 Mon Sep 17 00:00:00 2001 From: Celina Sophie Kalus Date: Thu, 8 Feb 2024 12:33:46 +0100 Subject: [PATCH] drivers: ipm: esp32: Allow doorbell without data transfer IPM drivers are commonly used to send notifications/cause interrupts without any transfer of data. To add this use case in the ESP32 IPM driver, the guard statement is appended so that the pointer to the data buffer is allowed to be zero only if the size of the data to be transferred is zero. If size is given as 0 and data is equal to NULL, we are thus only using the IPM as a doorbell, not to transfer data. Signed-off-by: Celina Sophie Kalus --- drivers/ipm/ipm_esp32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ipm/ipm_esp32.c b/drivers/ipm/ipm_esp32.c index 4fc504610a..ad27392332 100644 --- a/drivers/ipm/ipm_esp32.c +++ b/drivers/ipm/ipm_esp32.c @@ -95,7 +95,7 @@ static int esp32_ipm_send(const struct device *dev, int wait, uint32_t id, { struct esp32_ipm_data *dev_data = (struct esp32_ipm_data *)dev->data; - if (data == NULL) { + if (size > 0 && data == NULL) { LOG_ERR("Invalid data source"); return -EINVAL; }