diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 208e877d93d7..b809339f1776 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -1911,6 +1911,14 @@ static int d40_validate_conf(struct d40_chan *d40c, res = -EINVAL; } + if (conf->use_fixed_channel && + (conf->phy_channel < 0 || + conf->phy_channel >= d40c->base->num_phy_chans)) { + chan_err(d40c, "Invalid physical channel (%d)\n", + conf->phy_channel); + res = -EINVAL; + } + if (conf->dir == DMA_DEV_TO_DEV) { /* * DMAC HW supports it. Will be added to this driver,