drivers/dma: stm32 fix dmamux request id valid check

The request id is given by the DMA request MUX id which start at offset
1 and are vaid until req_nb + gen_nb.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This commit is contained in:
Thomas Stranger 2021-04-15 12:37:09 +02:00 committed by Kumar Gala
commit 04ee034f4b

View file

@ -94,8 +94,9 @@ int dmamux_stm32_configure(const struct device *dev, uint32_t id,
*/ */
int request_id = config->dma_slot; int request_id = config->dma_slot;
if (request_id >= dev_config->req_nb + dev_config->gen_nb) { if (request_id == 0 ||
LOG_ERR("request ID %d is too big.", request_id); request_id > dev_config->req_nb + dev_config->gen_nb) {
LOG_ERR("request ID %d is not valid.", request_id);
return -EINVAL; return -EINVAL;
} }