diff options
author | Wenchao Chen <wenchao.chen@unisoc.com> | 2022-09-07 11:58:47 +0800 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2022-09-14 12:03:32 +0200 |
commit | faded9b5572a27c1eaec19f3a2759b4547507731 (patch) | |
tree | db262ebb07d5cc01e4069df2c5ac2947fbea8182 | |
parent | 80e78fcce86de0288793a0ef0f6acf37656ee4cf (diff) | |
download | linux-faded9b5572a27c1eaec19f3a2759b4547507731.tar.gz linux-faded9b5572a27c1eaec19f3a2759b4547507731.tar.bz2 linux-faded9b5572a27c1eaec19f3a2759b4547507731.zip |
mmc: sdhci: Fix host->cmd is null
When data crc occurs, the kernel will panic because host->cmd is null.
Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
Fixes: efe8f5c9b5e1 ("mmc: sdhci: Capture eMMC and SD card errors")
Cc: stable@vger.kernel.org
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20220907035847.13783-1-wenchao.chen666@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/sdhci.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 7689ffec5ad1..251172890af7 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 (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)))) 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 (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)))) sdhci_err_stats_inc(host, DAT_CRC); } else if (intmask & SDHCI_INT_DATA_TIMEOUT) { *data_error = -ETIMEDOUT; |