public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Arun Nagendran <arunrasppi@gmail.com>
Cc: manonuevo@micron.com, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] Enable the read ECC before program the page
Date: Wed, 13 Sep 2017 12:04:25 -0700	[thread overview]
Message-ID: <20170913190425.GA27232@kroah.com> (raw)
In-Reply-To: <59b97a4e.cf02b00a.d8b82.a310@mx.google.com>

On Wed, Sep 13, 2017 at 02:34:53PM -0400, Arun Nagendran wrote:
> Current program_page function did following operation:
> 
> 1. read page (with ECC OFF)
> 2. modify the page
> 3. write the page (with ECC ON)
> 
> For some case(buggy flash Chip), while read the page without ECC ON,
> we may read the page with bit flip error and modify that bad page without
> knowing the bit flip error on that page.
> also we re-calculate the hash for bad page and write it.
> This could bring potential in-consistency problem with Flash data.
> 
> Verify this logic with GIGA DEVICE Part(GD5F2GQ4RCFIG):
> we see this in-conststency problem wit Giga Device and fix on
> this patch resovle that issue.
> ---
>  drivers/staging/mt29f_spinand/mt29f_spinand.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c
> index a4e3ae8..202d222 100644
> --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
> +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
> @@ -496,8 +496,13 @@ static int spinand_program_page(struct spi_device *spi_nand,
>  	if (!wbuf)
>  		return -ENOMEM;
>  
> -	enable_read_hw_ecc = 0;
> -	spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf);
> +	enable_read_hw_ecc = 1;
> +	retval = spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf);
> +	if( retval < 0 )
> +	{
> +		dev_err(&spi_nand->dev, "ecc error on read page!!!\n");
> +		return retval;
> +	}

Always use scripts/checkpatch.pl so you don't get grumpy maintainers
telling you to use scripts/checkpatch.pl :(

  reply	other threads:[~2017-09-13 19:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 18:34 [PATCH] Enable the read ECC before program the page Arun Nagendran
2017-09-13 19:04 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-13 19:15 Arun Nagendran
2017-09-13 21:31 ` Greg KH
2017-09-14 15:56   ` Arun Nagendran
2017-09-13 18:20 Arun Nagendran

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=20170913190425.GA27232@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arunrasppi@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=manonuevo@micron.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox