Skip to content

Commit b79fe18

Browse files
ISCAS-Vulabmiquelraynal
authored andcommitted
mtd: rawnand: Add status chack in r852_ready()
In r852_ready(), the dev get from r852_get_dev() need to be checked. An unstable device should not be ready. A proper implementation can be found in r852_read_byte(). Add a status check and return 0 when it is unstable. Fixes: 50a487e ("mtd: rawnand: Pass a nand_chip object to chip->dev_ready()") Cc: stable@vger.kernel.org # v4.20+ Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent d027951 commit b79fe18

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mtd/nand/raw/r852.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ static int r852_wait(struct nand_chip *chip)
387387
static int r852_ready(struct nand_chip *chip)
388388
{
389389
struct r852_device *dev = r852_get_dev(nand_to_mtd(chip));
390+
if (dev->card_unstable)
391+
return 0;
392+
390393
return !(r852_read_reg(dev, R852_CARD_STA) & R852_CARD_STA_BUSY);
391394
}
392395

0 commit comments

Comments
 (0)