From 15728ab23d00b19013a6cf5f8ed28d4f2ee5410a Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 6 Oct 2026 00:40:17 +0200 Subject: [PATCH] dmaengine: ste_dma40: Search all blocks for fixed logical channels Fixed logical channel allocation scans physical channels in blocks determined by the event-group layout. When the requested physical channel does not belong to the first block, d40_allocate_channel() returns -EINVAL instead of checking later blocks. Skip nonmatching blocks so controllers with multiple physical-channel blocks can allocate fixed logical channels from the later blocks. Fixes: 5cd326fd27da ("dmaengine/ste_dma40: allow fixed physical channel") Reported-by: sashiko-bot@kernel.org Closes: https://lore.kernel.org/dmaengine/20260819225008.5F9651F000E9@smtp.kernel.org/ Assisted-by: LLM Reviewed-by: Frank Li Signed-off-by: Linus Walleij Link: https://patch.msgid.link/20261006-dma40-fixes-v8-1-b0aadf804793@kernel.org Signed-off-by: Vinod Koul --- drivers/dma/ste_dma40.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 0ffdfd9a1c9d..d3cc2c512ccf 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -2128,11 +2128,8 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user) if (d40c->dma_cfg.use_fixed_channel) { i = d40c->dma_cfg.phy_channel; - if ((i != phy_num) && (i != phy_num + 1)) { - dev_err(dmaengine_chan_dev(&d40c->chan), - "invalid fixed phy channel %d\n", i); - return -EINVAL; - } + if (i != phy_num && i != phy_num + 1) + continue; if (d40_alloc_mask_set(&phys[i], is_src, event_line, is_log, first_phy_user))