All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: liaoweixiong <liaoweixiong@allwinnertech.com>
Cc: "Vignesh Raghavendra" <vigneshr@ti.com>,
	"Boris Brezillon" <bbrezillon@kernel.org>,
	"Richard Weinberger" <richard@nod.at>,
	linux-kernel@vger.kernel.org,
	"Chuanhong Guo" <gch981213@gmail.com>,
	"Marek Vasut" <marek.vasut@gmail.com>,
	"Frieder Schrempf" <frieder.schrempf@exceet.de>,
	"Clément Péron" <peron.clem@gmail.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	linux-mtd@lists.infradead.org,
	"Brian Norris" <computersforpeace@gmail.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Peter Pan" <peterpandong@micron.com>
Subject: Re: [PATCH] mtd: spinand: fix error read return value
Date: Wed, 19 Jun 2019 15:46:11 +0200	[thread overview]
Message-ID: <20190619154611.3bfc007b@collabora.com> (raw)
In-Reply-To: <1560950005-8868-1-git-send-email-liaoweixiong@allwinnertech.com>

Hi liaoweixiong,

On Wed, 19 Jun 2019 21:13:24 +0800
liaoweixiong <liaoweixiong@allwinnertech.com> wrote:

> In function spinand_mtd_read, if the last page to read occurs bitflip,
> this function will return error value because veriable ret not equal to 0.

Actually, that's exactly what the MTD core expects (see [1]), so you're
the one introducing a regression here.

Regards,

Boris

> 
> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>
> ---
>  drivers/mtd/nand/spi/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 556bfdb..6b9388d 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -511,12 +511,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
>  		if (ret == -EBADMSG) {
>  			ecc_failed = true;
>  			mtd->ecc_stats.failed++;
> -			ret = 0;
>  		} else {
>  			mtd->ecc_stats.corrected += ret;
>  			max_bitflips = max_t(unsigned int, max_bitflips, ret);
>  		}
>  
> +		ret = 0;
>  		ops->retlen += iter.req.datalen;
>  		ops->oobretlen += iter.req.ooblen;
>  	}

[1]https://elixir.bootlin.com/linux/latest/source/drivers/mtd/mtdcore.c#L1209

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: liaoweixiong <liaoweixiong@allwinnertech.com>
Cc: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Brian Norris" <computersforpeace@gmail.com>,
	"Marek Vasut" <marek.vasut@gmail.com>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Boris Brezillon" <bbrezillon@kernel.org>,
	"Frieder Schrempf" <frieder.schrempf@exceet.de>,
	"Peter Pan" <peterpandong@micron.com>,
	"Clément Péron" <peron.clem@gmail.com>,
	"Chuanhong Guo" <gch981213@gmail.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: spinand: fix error read return value
Date: Wed, 19 Jun 2019 15:46:11 +0200	[thread overview]
Message-ID: <20190619154611.3bfc007b@collabora.com> (raw)
In-Reply-To: <1560950005-8868-1-git-send-email-liaoweixiong@allwinnertech.com>

Hi liaoweixiong,

On Wed, 19 Jun 2019 21:13:24 +0800
liaoweixiong <liaoweixiong@allwinnertech.com> wrote:

> In function spinand_mtd_read, if the last page to read occurs bitflip,
> this function will return error value because veriable ret not equal to 0.

Actually, that's exactly what the MTD core expects (see [1]), so you're
the one introducing a regression here.

Regards,

Boris

> 
> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>
> ---
>  drivers/mtd/nand/spi/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 556bfdb..6b9388d 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -511,12 +511,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
>  		if (ret == -EBADMSG) {
>  			ecc_failed = true;
>  			mtd->ecc_stats.failed++;
> -			ret = 0;
>  		} else {
>  			mtd->ecc_stats.corrected += ret;
>  			max_bitflips = max_t(unsigned int, max_bitflips, ret);
>  		}
>  
> +		ret = 0;
>  		ops->retlen += iter.req.datalen;
>  		ops->oobretlen += iter.req.ooblen;
>  	}

[1]https://elixir.bootlin.com/linux/latest/source/drivers/mtd/mtdcore.c#L1209

  reply	other threads:[~2019-06-19 13:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 13:13 [PATCH] mtd: spinand: fix error read return value liaoweixiong
2019-06-19 13:13 ` liaoweixiong
2019-06-19 13:46 ` Boris Brezillon [this message]
2019-06-19 13:46   ` Boris Brezillon
2019-06-19 14:02   ` Schrempf Frieder
2019-06-19 14:02     ` Schrempf Frieder
2019-06-19 16:18     ` Boris Brezillon
2019-06-19 16:18       ` Boris Brezillon
2019-06-20  0:40       ` liaoweixiong
2019-06-20  0:40         ` liaoweixiong

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=20190619154611.3bfc007b@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@exceet.de \
    --cc=gch981213@gmail.com \
    --cc=liaoweixiong@allwinnertech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=peron.clem@gmail.com \
    --cc=peterpandong@micron.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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 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.