[PATCH 10/13] mmc: jz4740: Apply DMA max_seg_size limit to unified tx-rx channel
From: Lee Jones
Date: Mon Nov 23 2026 - 14:18:41 EST
Commit afadb04f1d6e ("mmc: jz4740: Apply DMA engine limits to maximum
segment size") added max_seg_size clamping at the end of
jz4740_mmc_acquire_dma_channels(), below the early return for the
unified "tx-rx" DMA channel added earlier by commit a474e52c3109 ("mmc:
jz4740: Support using a bi-directional DMA channel"). When "tx-rx" is
used, host->mmc->max_seg_size is never clamped to dma_get_max_seg_size()
and the MMC core can submit scatterlist segments exceeding the DMA
controller hardware limit.
Jump to the max_seg_size clamping block when acquiring the "tx-rx"
channel instead of returning early.
Fixes: afadb04f1d6e ("mmc: jz4740: Apply DMA engine limits to maximum segment size")
Closes: https://sashiko.dev/#/bug/linux-1f76aaa3-099b-4ac6-b793-e11a71bb003a
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/mmc/host/jz4740_mmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index e398a575f2dc..71aa7930a030 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -231,7 +231,7 @@ static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
host->dma_tx = dma_request_chan(dev, "tx-rx");
if (!IS_ERR(host->dma_tx))
- return 0;
+ goto out;
if (PTR_ERR(host->dma_tx) != -ENODEV) {
dev_err(dev, "Failed to get dma tx-rx channel\n");
@@ -251,6 +251,7 @@ static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
return PTR_ERR(host->dma_rx);
}
+out:
/*
* Limit the maximum segment size in any SG entry according to
* the parameters of the DMA engine device.
--
2.56.1.750.gf70dc682cf-goog