diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index 79d76cfa3b6..8f2989ec1b9 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -94,8 +94,9 @@ int dmamux_stm32_configure(const struct device *dev, uint32_t id, */ int request_id = config->dma_slot; - if (request_id >= dev_config->req_nb + dev_config->gen_nb) { - LOG_ERR("request ID %d is too big.", request_id); + if (request_id == 0 || + request_id > dev_config->req_nb + dev_config->gen_nb) { + LOG_ERR("request ID %d is not valid.", request_id); return -EINVAL; }