All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jernej Skrabec" <jernej.skrabec@gmail.com>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v2 3/3] mmc: sunxi: Distinguish CRC and timeout errors
Date: Thu, 26 Nov 2026 18:40:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-236028@kernel.org> (raw)
In-Reply-To: <20261126182944.3136900-4-jernej.skrabec@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mmc: sunxi: non-timeout errors set -ETIMEDOUT in
  sunxi_mmc_finalize_request()
--

commit 91cd8b46121add6c52d6b5bc5490c76bdc44d0e9
Author: Jernej Skrabec <jernej.skrabec@gmail.com>

mmc: sunxi: Distinguish CRC and timeout errors

This commit updates sunxi_mmc_finalize_request() to report CRC, start
bit, and end bit errors as -EILSEQ, timeouts as -ETIMEDOUT, and other
errors as -EIO.

> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
> index b862df26e1926..c2e84c22d3fad 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -537,13 +537,29 @@ static irqreturn_t sunxi_mmc_finalize_request(struct sunxi_mmc_host *host)
>  
>  	if (host->int_sum & SDXC_INTERRUPT_ERROR_BIT) {
>  		sunxi_mmc_dump_errinfo(host);
> -		mrq->cmd->error = -ETIMEDOUT;
> +
> +		if (host->int_sum &
> +		    (SDXC_RESP_ERROR | SDXC_RESP_CRC_ERROR))
> +			mrq->cmd->error = -EILSEQ;
> +		else if (host->int_sum & SDXC_RESP_TIMEOUT)
> +			mrq->cmd->error = -ETIMEDOUT;
>  
>  		if (data) {
> -			data->error = -ETIMEDOUT;
> +			if (host->int_sum &
> +			    (SDXC_DATA_CRC_ERROR | SDXC_START_BIT_ERROR |
> +			     SDXC_END_BIT_ERROR))
> +				data->error = -EILSEQ;
> +			else if (host->int_sum &
> +				 (SDXC_DATA_TIMEOUT | SDXC_FIFO_RUN_ERROR |
> +				  SDXC_HARD_WARE_LOCKED))
> +				data->error = -ETIMEDOUT;
> +
>  			host->manual_stop_mrq = mrq;
>  		}
>  
> +		if (!mrq->cmd->error && (!data || !data->error))
> +			mrq->cmd->error = -EIO;

[Severity: Medium]
Should SDXC_FIFO_RUN_ERROR and SDXC_HARD_WARE_LOCKED be reported as -EIO
rather than setting data->error to -ETIMEDOUT?

SDXC_INTERRUPT_ERROR_BIT contains only the nine bits already tested by the
cmd and data branches above:

drivers/mmc/host/sunxi-mmc.c:
#define SDXC_INTERRUPT_ERROR_BIT \
	(SDXC_RESP_ERROR | SDXC_RESP_CRC_ERROR | SDXC_DATA_CRC_ERROR | \
	 SDXC_RESP_TIMEOUT | SDXC_DATA_TIMEOUT | SDXC_FIFO_RUN_ERROR | \
	 SDXC_HARD_WARE_LOCKED | SDXC_START_BIT_ERROR | SDXC_END_BIT_ERROR)

When data is non-NULL, grouping SDXC_FIFO_RUN_ERROR and
SDXC_HARD_WARE_LOCKED with SDXC_DATA_TIMEOUT means a FIFO underrun/overrun
or hardware lock error during a data transfer sets data->error = -ETIMEDOUT
instead of -EIO, and the !data->error fallback check below can never trigger.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126182944.3136900-1-jernej.skrabec@gmail.com?part=3

      reply	other threads:[~2026-11-26 18:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 18:29 [PATCH v2 0/3] mmc: sunxi: preparation for A523 UHS support Jernej Skrabec
2026-11-26 18:29 ` [PATCH v2 1/3] mmc: sunxi: Set the IDMA DMA mask Jernej Skrabec
2026-11-26 18:29 ` [PATCH v2 2/3] mmc: sunxi: Build IDMA descriptors from mapped SG list Jernej Skrabec
2026-11-26 18:35   ` sashiko-bot
2026-11-26 18:29 ` [PATCH v2 3/3] mmc: sunxi: Distinguish CRC and timeout errors Jernej Skrabec
2026-11-26 18:40   ` sashiko-bot [this message]

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=sashiko-outbox-236028@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.