From: "Ying-Chun Liu (PaulLiu)" <paul.liu@xxxxxxxxxx> If we don't check host->cmd. We will get the following oops when booting from eMMC on RockPi4. Unable to handle kernel read from unreadable memory at virtual address 0000000000000000 Call trace: sdhci_cqe_irq+0x40/0x254 Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@xxxxxxxxxx> Signed-off-by: Ram Muthiah <rammuthiah@xxxxxxxxxx> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx> Cc: Ritesh Harjani <riteshh@xxxxxxxxxxxxxx> Cc: Asutosh Das <asutoshd@xxxxxxxxxxxxxx> Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Cc: linux-mmc@xxxxxxxxxxxxxxx --- drivers/mmc/host/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 7689ffec5ad1..e0e7768bd6c0 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3928,7 +3928,7 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error, if (intmask & (SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC)) { *cmd_error = -EILSEQ; - if (!mmc_op_tuning(host->cmd->opcode)) + if (host->cmd && !mmc_op_tuning(host->cmd->opcode)) sdhci_err_stats_inc(host, CMD_CRC); } else if (intmask & SDHCI_INT_TIMEOUT) { *cmd_error = -ETIMEDOUT; @@ -3938,7 +3938,7 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error, if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC)) { *data_error = -EILSEQ; - if (!mmc_op_tuning(host->cmd->opcode)) + if (host->cmd && !mmc_op_tuning(host->cmd->opcode)) sdhci_err_stats_inc(host, DAT_CRC); } else if (intmask & SDHCI_INT_DATA_TIMEOUT) { *data_error = -ETIMEDOUT; -- 2.35.1