All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org, Peter Pan <peterpansjtu@gmail.com>,
	Frieder Schrempf <frieder.schrempf@exceet.de>,
	Vignesh R <vigneshr@ti.com>,
	Xiangsheng Hou <xiangsheng.hou@mediatek.com>,
	Peter Pan <peterpandong@micron.com>
Subject: Re: [PATCH v7 2/5] mtd: nand: Add core infrastructure to support SPI NANDs
Date: Thu, 31 May 2018 09:38:02 +0200	[thread overview]
Message-ID: <20180531093802.3799dbdf@bbrezillon> (raw)
In-Reply-To: <20180531093005.47fb5409@xps13>

Hi Miquel,

On Thu, 31 May 2018 09:30:05 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hi Boris,
> 
> On Tue, 15 May 2018 17:08:22 +0200, Boris Brezillon
> <boris.brezillon@bootlin.com> wrote:
> 
> > +static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
> > +{
> > +	struct spinand_device *spinand = nand_to_spinand(nand);
> > +	struct nand_page_io_req req = {
> > +		.pos = *pos,
> > +		.ooblen = 2,
> > +		.ooboffs = 0,
> > +		.oobbuf.in = spinand->oobbuf,
> > +		.mode = MTD_OPS_RAW,
> > +	};
> > +	int ret;
> > +
> > +	memset(spinand->oobbuf, 0, 2);
> > +	spinand_select_target(spinand, pos->target);
> > +	ret = spinand_read_page(spinand, &req, false);  
> 
> I got a warning here because ret is not checked, maybe a:
> 
>         if (ret) {
>                 dev_err(dev, "...");
>                 return false;
>         }

Or we could just ignore spinand_read_page() ret code since the first 2
bytes of spinand->oobbuf are initialized to 0, which means the block
will be considered bad if the read fails.

> 
> ?
> 
> > +	if (spinand->oobbuf[0] != 0xff || spinand->oobbuf[1] != 0xff)
> > +		return true;
> > +
> > +	return false;
> > +}  
> 
> Thanks,
> Miquèl

  reply	other threads:[~2018-05-31  7:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 15:08 [PATCH v7 0/5] mtd: Add a SPI NAND driver Boris Brezillon
2018-05-15 15:08 ` [PATCH v7 1/5] mtd: nand: Pass mode information to nand_page_io_req Boris Brezillon
2018-06-01 10:11   ` Miquel Raynal
2018-06-01 10:17   ` Frieder Schrempf
2018-06-01 12:55   ` Boris Brezillon
2018-05-15 15:08 ` [PATCH v7 2/5] mtd: nand: Add core infrastructure to support SPI NANDs Boris Brezillon
2018-05-29 10:57   ` Frieder Schrempf
2018-05-29 13:35     ` Boris Brezillon
2018-05-29 14:59       ` Frieder Schrempf
2018-06-01 10:22         ` Frieder Schrempf
2018-05-31  7:30   ` Miquel Raynal
2018-05-31  7:38     ` Boris Brezillon [this message]
2018-05-15 15:08 ` [PATCH v7 3/5] dt-bindings: Add bindings for SPI NAND devices Boris Brezillon
2018-05-15 15:08 ` [PATCH v7 4/5] mtd: nand: spi: Add initial support for Micron MT29F2G01ABAGD Boris Brezillon
2018-05-15 15:08 ` [PATCH v7 5/5] mtd: nand: spi: Add initial support for Winbond W25M02GV Boris Brezillon
2018-05-15 22:59   ` Miquel Raynal
2018-05-16  7:07     ` Boris Brezillon
2018-05-17  6:33 ` [PATCH v7 0/5] mtd: Add a SPI NAND driver Prabhakar Kushwaha
2018-05-17  7:05   ` Boris Brezillon
2018-05-17 10:01     ` Prabhakar Kushwaha
2018-05-17 10:22       ` Frieder Schrempf

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=20180531093802.3799dbdf@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@exceet.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=peterpandong@micron.com \
    --cc=peterpansjtu@gmail.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=xiangsheng.hou@mediatek.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.