Skip to content

Commit

Permalink
mtd: rawnand: Add status chack in r852_ready()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wentao Liang authored and Miquel Raynal committed Apr 7, 2025
1 parent d027951 commit b79fe18
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mtd/nand/raw/r852.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ static int r852_wait(struct nand_chip *chip)
static int r852_ready(struct nand_chip *chip)
{
struct r852_device *dev = r852_get_dev(nand_to_mtd(chip));
if (dev->card_unstable)
return 0;

return !(r852_read_reg(dev, R852_CARD_STA) & R852_CARD_STA_BUSY);
}

Expand Down

0 comments on commit b79fe18

Please sign in to comment.