Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Paul Cercueil <paul@crapouillou.net>,
	Ulf Hansson <ulfh@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Aidan MacDonald <aidanmacdonald.0x0@gmail.com>,
	linux-mips@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 10/13] mmc: jz4740: Apply DMA max_seg_size limit to unified tx-rx channel
Date: Mon, 23 Nov 2026 19:15:54 +0000	[thread overview]
Message-ID: <20261123191703.179283-11-lee@kernel.org> (raw)
In-Reply-To: <20261123191703.179283-1-lee@kernel.org>

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@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 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


      parent reply	other threads:[~2026-11-23 19:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 19:15 [PATCH 00/13] mmc: Assorted bug fixes across MMC host drivers Lee Jones
2026-11-23 19:15 ` [PATCH 05/13] mmc: jz4740: Skip DMA cleanup in PIO mode during post_req Lee Jones
2026-11-23 19:15 ` Lee Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123191703.179283-11-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=aidanmacdonald.0x0@gmail.com \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=stable@vger.kernel.org \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox