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 <[email protected]> --- 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; -- 2.47.3
