Skip to contentSkip to conversation

mtd: rawnand: atmel: Check return values for nand_read_data_op

PATCH Applied Alex Dewar 2 participants 2 messages Sep 14, 2020 – Sep 15, 2020

Subsystems (4)
lore
Share & tools
lore

Alex Dewar

author
#0 lore raw

PATCH 1/1 mtd: rawnand: atmel: Check return values for nand_read_data_op

In atmel_nand_pmecc_read_pg(), nand_read_data_op() is called twice without the return values being checked for errors. Add these checks.

---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +8 -2
index 309ce410d792..e6ceec8f50dc 100644
@@ -948,11 +948,17 @@ static int atmel_nand_pmecc_read_pg(struct nand_chip *chip, u8 *buf,
 	if (ret)
 		return ret;
 
-	nand_read_data_op(chip, buf, mtd->writesize, false, false);
-	nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
+	ret = nand_read_data_op(chip, buf, mtd->writesize, false, false);
+	if (ret)
+		goto out_disable;
+
+	ret = nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
+	if (ret)
+		goto out_disable;
 
 	ret = atmel_nand_pmecc_correct_data(chip, buf, raw);
 
+out_disable:
 	atmel_nand_pmecc_disable(chip, raw);
 
 	return ret;
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Alex Dewar

In atmel_nand_pmecc_read_pg(), nand_read_data_op() is called twice without the return values being checked for errors. Add these checks.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

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