From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: Michael Tretter <m.tretter@pengutronix.de>,
Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: Re: [PATCH 02/10] mci: mmc_send_tuning: actually point data.dest at the buffer
Date: Mon, 11 May 2026 14:49:17 +0200 [thread overview]
Message-ID: <ac277f5b-8a1b-4325-bf3e-5ed73d9733ab@pengutronix.de> (raw)
In-Reply-To: <20260511-rockchip-emmc-hs400-v1-2-515fb6d20e12@pengutronix.de>
Hello Sascha,
On 5/11/26 2:07 PM, Sascha Hauer wrote:
> mmc_send_tuning() allocates a tuning-block-sized buffer with calloc()
> but never assigns it to data.dest, so the host transfers the tuning
> block to wherever data.dest happened to be (uninitialised — typically
> NULL). The subsequent memcmp against the expected pattern then always
> mismatches, so any caller would observe -EIO regardless of the
> controller actually receiving the block correctly.
>
> Fix by setting data.dest to the buffer.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
But ouch. Apparently, I had added this, but it remained unused until
Steffen added cadence-sdhci as first user.
I recall there were issues with that driver, so Cc'ing Steffen and
Michael to make them aware of this change.
Cheers,
Ahmad
> ---
> drivers/mci/mci-core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 33934a6a35..23b9117869 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1684,6 +1684,7 @@ int mmc_send_tuning(struct mci *mci, u32 opcode)
> mci_setup_cmd(&cmd, opcode, 0, MMC_RSP_R1 | MMC_CMD_ADTC);
>
> cmd.data = xzalloc(sizeof(struct mci_data));
> + cmd.data->dest = data_buf;
> cmd.data->blocksize = size;
> cmd.data->blocks = 1;
> cmd.data->flags = MMC_DATA_READ;
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-05-11 12:50 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 12:07 [PATCH 00/10] mci: rockchip-dwcmshc: add HS400(ES) support Sascha Hauer
2026-05-11 12:07 ` [PATCH 01/10] mci: sdhci: define VDD_180 and shrink UHS_MASK to bits 0..2 Sascha Hauer
2026-05-18 8:58 ` Ahmad Fatoum
2026-05-11 12:07 ` [PATCH 02/10] mci: mmc_send_tuning: actually point data.dest at the buffer Sascha Hauer
2026-05-11 12:49 ` Ahmad Fatoum [this message]
2026-05-11 12:07 ` [PATCH 03/10] mci: sdhci: add ADMA2 descriptor helpers Sascha Hauer
2026-05-18 9:18 ` Ahmad Fatoum
2026-05-18 12:16 ` Sascha Hauer
2026-05-18 12:20 ` Ahmad Fatoum
2026-05-11 12:07 ` [PATCH 04/10] mci: add HS400 mode selection Sascha Hauer
2026-05-18 9:36 ` Ahmad Fatoum
2026-05-18 12:35 ` Sascha Hauer
2026-05-11 12:08 ` [PATCH 05/10] mci: add HS400 Enhanced Strobe (HS400ES) selection Sascha Hauer
2026-05-18 9:54 ` Ahmad Fatoum
2026-05-18 13:06 ` Sascha Hauer
2026-05-11 12:08 ` [PATCH 06/10] mci: rockchip-dwcmshc-sdhci: use ADMA2 Sascha Hauer
2026-05-11 12:55 ` Ahmad Fatoum
2026-05-11 14:01 ` Sascha Hauer
2026-05-11 14:06 ` Ahmad Fatoum
2026-05-11 12:08 ` [PATCH 07/10] mci: sdhci: rockchip: set TX-path source-select bit in DWCMSHC_EMMC_DLL_TXCLK Sascha Hauer
2026-05-18 9:57 ` Ahmad Fatoum
2026-05-11 12:08 ` [PATCH 08/10] mci: sdhci: rockchip: distinguish IP revision 0 (rk3568) from 1 (rk3576/rk3588) Sascha Hauer
2026-05-18 9:59 ` Ahmad Fatoum
2026-05-11 12:08 ` [PATCH 09/10] mci: sdhci: rockchip: support HS400 Sascha Hauer
2026-05-18 10:09 ` Ahmad Fatoum
2026-05-11 12:08 ` [PATCH 10/10] mci: sdhci: rockchip: support HS400 Enhanced Strobe Sascha Hauer
2026-05-18 10:10 ` Ahmad Fatoum
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=ac277f5b-8a1b-4325-bf3e-5ed73d9733ab@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=m.tretter@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=s.trumtrar@pengutronix.de \
/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