mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH Vx 5/5] mmc: sdhci: Fix host->cmd is null
@ 2022-09-07  3:58 Wenchao Chen
  2022-09-07  7:01 ` Adrian Hunter
  2022-09-14 14:00 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Wenchao Chen @ 2022-09-07  3:58 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson; +Cc: linux-mmc, linux-kernel, zhang.lyra, lzx.stg

From: Wenchao Chen <wenchao.chen@unisoc.com>

When data crc occurs, the kernel will panic because host->cmd is null.

Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
---
 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 7689ffe..2511728 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;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH Vx 5/5] mmc: sdhci: Fix host->cmd is null
  2022-09-07  3:58 [PATCH Vx 5/5] mmc: sdhci: Fix host->cmd is null Wenchao Chen
@ 2022-09-07  7:01 ` Adrian Hunter
  2022-09-14 14:00 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2022-09-07  7:01 UTC (permalink / raw)
  To: Wenchao Chen, ulf.hansson; +Cc: linux-mmc, linux-kernel, zhang.lyra, lzx.stg

Don't know what is going on with the "Vx 5/5"?  Ignoring it.

On 7/09/22 06:58, Wenchao Chen wrote:
> From: Wenchao Chen <wenchao.chen@unisoc.com>
> 
> When data crc occurs, the kernel will panic because host->cmd is null.
> 

Fixes: efe8f5c9b5e1 ("mmc: sdhci: Capture eMMC and SD card errors")

> Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>

Cc: stable@vger.kernel.org

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Thank you!

> ---
>  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 7689ffe..2511728 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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH Vx 5/5] mmc: sdhci: Fix host->cmd is null
  2022-09-07  3:58 [PATCH Vx 5/5] mmc: sdhci: Fix host->cmd is null Wenchao Chen
  2022-09-07  7:01 ` Adrian Hunter
@ 2022-09-14 14:00 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2022-09-14 14:00 UTC (permalink / raw)
  To: Wenchao Chen; +Cc: adrian.hunter, linux-mmc, linux-kernel, zhang.lyra, lzx.stg

On Wed, 7 Sept 2022 at 06:00, Wenchao Chen <wenchao.chen666@gmail.com> wrote:
>
> From: Wenchao Chen <wenchao.chen@unisoc.com>
>
> When data crc occurs, the kernel will panic because host->cmd is null.
>
> Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>

Applied for fixes, thanks!

Kind regards
Uffe


> ---
>  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 7689ffe..2511728 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;
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-14 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07  3:58 [PATCH Vx 5/5] mmc: sdhci: Fix host->cmd is null Wenchao Chen
2022-09-07  7:01 ` Adrian Hunter
2022-09-14 14:00 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®