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 <hello@celinakalus.de>
This commit is contained in:
Celina Sophie Kalus 2024-02-08 12:33:46 +01:00 committed by Fabio Baltieri
parent a7ca6e5c17
commit 83192c71e4

View file

@ -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;
}