lkml.org 
[lkml]   [2022]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mmc: block: Dont report successful writes with errors
From
On 19/07/22 18:34, Christian Loehle wrote:
> Be as conservative about successful write reporting to the
> block layer for SPI as with normal SD and MMC.
> That means on any errors bytes_xfered is ignored and the
> whole write must be repeated.
>
> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
> ---
> drivers/mmc/core/block.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index f4a1281658db..63d1c05582a9 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -1765,8 +1765,12 @@ static bool mmc_blk_status_error(struct request *req, u32 status)
> struct mmc_queue *mq = req->q->queuedata;
> u32 stop_err_bits;
>
> + /*
> + * Either write timed out during busy and data->error is set
> + * or we actually received a valid R2 and check for error bits.
> + */
> if (mmc_host_is_spi(mq->card->host))
> - return false;
> + return brq->data.error || !!status;

This function is for checking status, so brq->data.error does not
belong here. Also it would be more readable to use a define e.g.

return status & SPI_R2_ERRORS;

I think clearing bytes_xfered for SPI brq->data.error should be a
separate patch, and you would need to explain a bit more for that
case too.

>
> stop_err_bits = mmc_blk_stop_err_bits(brq);
>

\
 
 \ /
  Last update: 2022-07-23 09:44    [W:0.108 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site